dharr

Dr. David Harrington

3813 Reputation

17 Badges

18 years, 153 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

@dharr CayleyTableGroup is another way. (CustomGroup could also be used.) - works for add and multiply

restart

with(GroupTheory)

Addition mod 7

Madd := Matrix(7, 7, proc (i, j) options operator, arrow; `mod`(i+j-2, 7)+1 end proc)

Matrix(%id = 36893490821750137428)

Gadd := CayleyTableGroup(Madd)

_m2674416000448

lblsadd := proc (i) options operator, arrow; i-1 end proc

proc (i) options operator, arrow; i-1 end proc

DrawCayleyTable(Gadd, labels = lblsadd)

Multiplication mod 7

Mmult := Matrix(6, 6, proc (i, j) options operator, arrow; `mod`(i*j, 7) end proc)

Matrix(%id = 36893490821805543780)

Gmult := CayleyTableGroup(Mmult)

_m2674386086240

CayleyTable(Gmult)

Array(%id = 36893490821805550876)

But strangely the ordering is different here:

DrawCayleyTable(Gmult)

``

Download mod7.mw

I'm assuming you really want a group, rather than just doing arithmetic mod n. The addition case is just the CyclicGroup:

with(GroupTheory)

G := CyclicGroup(7)

_m1835422256320

lbl:=proc(el) local i;
  i:=convert(el,'list');
  if nops(i)=0 then 0 else i[1]-1 end if;
end proc:
     

DrawCayleyTable(G, labels = lbl)

 

 

Download mod7.mw

Following @Mariusz Iwaniuk but can't get the last step.

Download summation.mw

I clicked on a pMML link (5.13.E1), which downloaded a file. I opened it in a text editor, selected all the text and copied it. In a Maple 2D input region, I pasted and it asked me if I wanted to convert MathML to 2D input, and I said yes. It looks a little strange in the input region (not as bad as here), but seems to be functionally OK.

restart

q := (int(GAMMA(s+a)*GAMMA(b-s)*z^(-s), s = c-i*infinity .. c+i*infinity))/(2*Pi*i) = GAMMA(a+b)*z^a/(1+z)^(a+b)

(1/2)*(int(GAMMA(s+a)*GAMMA(b-s)*z^(-s), s = c-i*infinity .. c+i*infinity))/(Pi*i) = GAMMA(a+b)*z^a/(1+z)^(a+b)

lprint(q)

1/2/Pi/i*int(GAMMA(s+a)*GAMMA(b-s)*z^(-s),s = c-i*infinity .. c+i*infinity) =
GAMMA(a+b)*z^a/((1+z)^(a+b))

NULL

Download PMML.mw

Perhaps you want to assume n is an integer, or even or odd, in which case the following may help. If you want to use the +/- symbol, then that is not as easily done.

X := -1

-1

X^n

(-1)^n

`assuming`([simplify(X^n)], [n::even])

1

`assuming`([simplify(X^n)], [n::odd])

-1

Y := 1

1

Y^n

1

``

Download Xn.mw

@Kitonum's method requires retyping of the variable names on the lhs. This can be avoided with assign.

restart

sys := {T__1 = m__1*a, a = R*alpha, -R*T__1+R*T__2 = I__s*a/R, g*m__2-T__2 = m__2*a}

vars := {T__1, T__2, a, alpha}

params := `minus`(indets(sys), vars)

NULL

ans := solve(sys, vars)

{T__1 = R^2*g*m__2*m__1/(R^2*m__1+R^2*m__2+I__s), T__2 = m__2*g*(R^2*m__1+I__s)/(R^2*m__1+R^2*m__2+I__s), a = R^2*g*m__2/(R^2*m__1+R^2*m__2+I__s), alpha = R*g*m__2/(R^2*m__1+R^2*m__2+I__s)}

map(proc (x) options operator, arrow; assign(lhs(x) = unapply(rhs(x), params[])) end proc, ans)

{}

op(a)

proc (I__s, R, g, m__1, m__2) options operator, arrow; R^2*g*m__2/(R^2*m__1+R^2*m__2+I__s) end proc

a(1, 2, 3, 4, 5)

60/37

NULL

Download solveEqs.mw

The ExportMatrix command can take a list of Matrices and write them to a MATLAB format file. See the help page for more details.

I don't know the exact answer. I found it confusing that you added the types in the module within the module; maybe it is a scoping issue. Why not just add them in the ModuleLoad procedure of RationalTrigonometry? (And for debugging purposes, I'd comment out any lines that remove them, in case they were added and the removed before you intended.)

Perhaps this is what you recall.

de:=gfun:-algeqtodiffeq(y = y^2*z + 1, y(z))

gives

The thing on the left-hand side of an assignment (:=) can't be an expression like lambda^m. You could assign to, say, lambda_m, but it would just be a name.

Perhaps you want something like eqn[m] instead of lambda^m?

Use mul for this, just

mul(v)

or

mul(i, i in v)

 

You do need to change to x=1/I to do linear least squares. 

restart

with(Statistics); with(plots); interface(imaginaryunit = I)

data := LinearAlgebra:-Transpose(`<,>`(`<|>`(1.31, 1.01, .81, .67, .56), `<|>`(1, 1.5, 2, 2.5, 3)))

Matrix(%id = 36893490698736924180)

Not linear, so use nonlinear least squares

plot(data, style = point)

Fit(U/I-R__i, data, I)

-HFloat(0.454173024787339)+HFloat(1.9582384498777987)/I

Take reciprocal of I to get x

data2 := `<|>`(`~`[`^`](data[() .. (), 1], -1), data[() .. (), 2])

Matrix(%id = 36893490698736840204)

Now linear

p1 := plot(data2, style = point); display(p1)

Get the same numbers.

eqn := Fit(U*x-R__i, data2, x)

-HFloat(0.454173024787339)+HFloat(1.9582384498777987)*x

display(p1, plot(eqn, x = .5 .. 2))

X := data2[() .. (), 1]; Y := data2[() .. (), 2]

Vector(5, {(1) = .7633587786, (2) = .9900990099, (3) = 1.234567901, (4) = 1.492537313, (5) = 1.785714286})

Vector[column](%id = 36893490698744642724)

Do it the hard way (eqns from Wikipedia page)

sumX := add(X); sumY := add(Y); sumX2 := add(x^2, `in`(x, X)); sumXY := X.Y

6.266277288

10.0

8.503613718

13.8061292359499994

eq1 := numelems(X)*a+b*sumX = sumY; eq2 := a*sumX+b*sumX2 = sumXY

5*a+6.266277288*b = 10.0

6.266277288*a+8.503613718*b = 13.8061292359499994

solve({eq1, eq2}, {a, b})

{a = -.4541730232, b = 1.958238449}

NULL

Download Mapleprimes_Question_Book_2_Paragraph_5.12_Question_3.mw

Use

W := Matrix(2, 2, [[a, b], [c, d]])

not Array for "." to work correctly.

For varying initial conditions on one variable (x in the worksheet) use DEplot. Example in the attached worksheet.

Download DEplot.mw

des := {diff(x(t), t) = -x(t), diff(y(t), t) = -y(t)^2};
DEtools:-DEplot(des, {x(t), y(t)}, 0 .. 4,
                [[x(0) = 1, y(0) = 1],[x(0) = 2, y(0) = 1]], scene = [t, x]);

 

@tomleslie's generation of a CSV file is correct, but if you want it named as a .txt file just use

Export("E:\\M.txt", M, format = "CSV");

Your error message was because Export wants the filename before the data.

1 2 3 4 5 6 7 Last Page 1 of 46