dharr

Dr. David Harrington

8215 Reputation

22 Badges

20 years, 339 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 retired professor of chemistry at the University of Victoria, BC, Canada. 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

Interesting. This difference is already present in the example (a,b,c)||2, which works in 2-D and not in 1-D. The parsers are not the same. The help suggests that the left hand side of || should be a name or string, and in1-D it doesn't seem to distribute like (a,b,c)*2 does. I would code this as

seq(seq(cat(i,j),i in [$("A".."C"),$("d".."f")]),j in [$("G".."I"),$("j".."l")]);

which seems a little more readable to me.

I agree with @tomleslie that there is something wrong here with Maple's processing, since this is a straightforward first order system. Another way to work around this is to solve exactly using laplace transforms (method=laplace). Then you can just plot the answers, which are sums of exponential decays.

Edit: I submitted an SCR about this.

restart

sys := {diff(a[0](t), t)-(diff(a[1](t), t))+diff(a[2](t), t)-(diff(a[3](t), t))+diff(a[4](t), t)-(diff(a[5](t), t)) = 0, diff(b[0](t), t)+diff(b[1](t), t)+diff(b[2](t), t)+diff(b[3](t), t)+diff(b[4](t), t)+diff(b[5](t), t) = 0, diff(a[0](t), t)-.8090169943*(diff(a[1](t), t))+.309016994*(diff(a[2](t), t))-16*a[2](t)+.3090169950*(diff(a[3](t), t))+77.66563145*a[3](t)-.809016994*(diff(a[4](t), t))-187.3312629*a[4](t)+1.000000002*(diff(a[5](t), t))+289.4427191*a[5](t) = 0, diff(a[0](t), t)-.3090169938*(diff(a[1](t), t))-.8090169951*(diff(a[2](t), t))-16*a[2](t)+.8090169933*(diff(a[3](t), t))+29.66563140*a[3](t)+.3090169967*(diff(a[4](t), t))+27.33126306*a[4](t)-1.000000000*(diff(a[5](t), t))-110.5572808*a[5](t) = 0, diff(a[0](t), t)+.3090169938*(diff(a[1](t), t))-.8090169951*(diff(a[2](t), t))-16*a[2](t)-.8090169933*(diff(a[3](t), t))-29.66563140*a[3](t)+.3090169967*(diff(a[4](t), t))+27.33126306*a[4](t)+1.000000000*(diff(a[5](t), t))+110.5572808*a[5](t) = 0, diff(a[0](t), t)+.8090169943*(diff(a[1](t), t))+.309016994*(diff(a[2](t), t))-16*a[2](t)-.3090169950*(diff(a[3](t), t))-77.66563145*a[3](t)-.809016994*(diff(a[4](t), t))-187.3312629*a[4](t)-1.000000002*(diff(a[5](t), t))-289.4427191*a[5](t) = 0, diff(a[1](t), t)+4*(diff(a[2](t), t))+9*(diff(a[3](t), t))+16*(diff(a[4](t), t))+25*(diff(a[5](t), t))-3*(diff(b[1](t), t))+12*(diff(b[2](t), t))-27*(diff(b[3](t), t))+48*(diff(b[4](t), t))-75*(diff(b[5](t), t)) = 0, diff(b[0](t), t)-.8090169943*(diff(b[1](t), t))+.309016994*(diff(b[2](t), t))-48*b[2](t)+.3090169950*(diff(b[3](t), t))+232.9968944*b[3](t)-.809016994*(diff(b[4](t), t))-561.9937886*b[4](t)+1.000000002*(diff(b[5](t), t))+868.3281572*b[5](t) = 0, diff(b[0](t), t)-.3090169938*(diff(b[1](t), t))-.8090169951*(diff(b[2](t), t))-48*b[2](t)+.8090169933*(diff(b[3](t), t))+88.99689421*b[3](t)+.3090169967*(diff(b[4](t), t))+81.99378917*b[4](t)-1.000000000*(diff(b[5](t), t))-331.6718425*b[5](t) = 0, diff(b[0](t), t)+.3090169938*(diff(b[1](t), t))-.8090169951*(diff(b[2](t), t))-48*b[2](t)-.8090169933*(diff(b[3](t), t))-88.99689421*b[3](t)+.3090169967*(diff(b[4](t), t))+81.99378917*b[4](t)+1.000000000*(diff(b[5](t), t))+331.6718425*b[5](t) = 0, diff(b[0](t), t)+.8090169943*(diff(b[1](t), t))+.309016994*(diff(b[2](t), t))-48*b[2](t)-.3090169950*(diff(b[3](t), t))-232.9968944*b[3](t)-.809016994*(diff(b[4](t), t))-561.9937886*b[4](t)-1.000000002*(diff(b[5](t), t))-868.3281572*b[5](t) = 0, diff(a[0](t), t)+diff(a[1](t), t)+diff(a[2](t), t)+diff(a[3](t), t)+diff(a[4](t), t)+diff(a[5](t), t)-(diff(b[0](t), t))+diff(b[1](t), t)-(diff(b[2](t), t))+diff(b[3](t), t)-(diff(b[4](t), t))+diff(b[5](t), t) = 0}

ics := {a[0](0) = 0.7499999990e-1, a[1](0) = .1500000001, a[2](0) = .1500000002, a[3](0) = .1500000000, a[4](0) = .1499999999, a[5](0) = 0.7499999987e-1, b[0](0) = .9750000000, b[1](0) = 0.5000000005e-1, b[2](0) = -0.5000000005e-1, b[3](0) = 0.5000000000e-1, b[4](0) = -0.4999999998e-1, b[5](0) = 0.2499999996e-1}

vars := [seq(a[i](t), i = 0 .. 5), seq(b[i](t), i = 0 .. 5)]

ans := evalf(dsolve(`union`(sys, ics), vars, method = laplace))

plot(eval(vars, ans), t = 0 .. 1)

ans[1]

a[0](t) = .3749999998+0.4751150840e-3*exp(-432.4166894*t)-0.2616281798e-2*exp(-245.9032514*t)+0.7402987796e-2*exp(-145.3319702*t)-0.4647601976e-1*exp(-119.1950503*t)-0.9154192475e-2*exp(-61.97921418*t)-0.5535077677e-2*exp(-36.29183506*t)-0.6820439432e-1*exp(-14.50379126*t)-.1758921368*exp(-4.519373969*t)

NULL

Download dsolve2.mw

In version 2022.2, your document looks and works as you say - the plot command is there, the plots are empty and the 1 seems to be the problem. So this seems to be a bug, and I have submitted an SCR.

select works on the operands that satisfy the condition, so can be tricky to use. In your case ee is an equation - whattype(ee) returns `=`, and the operands of an equation are the left and right sides - try op(ee) to see this. So you selected the sides of the equation that satisfied the condition. Since the left-hand side has dx you got the left-hand side back and since the right-hand side didn't you got back nothing for the right-hand side. It you want to extract terms, then you need to work on a sum - try expand(lhs(ee)) and you will see it is a sum of terms (lhs(ee) is a product of m and something else so won't work here).

So 

select(has, expand(lhs(ee)), dx) 

will work here.

The last two odes are the same, so when you put them into the set the duplicate is removed. Try nops(sys) and you will get 7, not 8. 

For future use, it is helpful to upload the worksheet - use the big green up-arrow.

The result you wanted wasn't achieved because you just put the statement Eq; which just displays the existing contents of Eq. Notice that in the second use..end use you did achieve what you wanted because there you were multiplying.

layout = network comes closest to what you want, and I think is intended for this purpose. The loops prevent using this layout option directly, but you can remove the loops, find the vertex positions and then apply them to the graph with loops. It does seem strange that there are backward arrows.

Download Graph.mw

Here it is working in 1-D, but when I change to 2-D it doesn't work.

restart

interface(version)

with(Physics[Vectors])

Physics:-Version()

Setup(mathematicalnotation = true)

with(Physics)
Setup(quantumoperators = {Omega, r})

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

`The "Physics Updates" version in the MapleCloud is 1359 and is the same as the version installed in this computer, created 2022, December 23, 12:46 hours Pacific Time.`

m*Omega^2*r
lprint(m*Omega^2*r)

m*Physics:-`*`(Physics:-`^`(Omega, 2), r)

m*Physics:-`*`(Physics:-`^`(Omega,2),r)

use   `*`= :-`.` in
a := m*Omega^2*r
end use

`.`(m, Physics:-`^`(Omega, 2), r)

lprint(a)

m . Physics:-`^`(Omega,2) . r

NULL

Download PhysVec2.mw

TextAreas can be used for user numeric input - see attached. A Data Table can be used as well.

textarea.mw

Edit: GetProperty returns a string, but the Do command returns a value.

I found on 2022.2 and Windows 10 that it did time out after about 2 mins (using Windows clock), which the status bar said was 288 s, so much greater than the 60 s specified. Same without the try/catch. The stop icon worked up to that time. It didn't hang.

Then I tried 100 s and it timed out at 268 s, i.e., about the same time, which would be consistent with "the execution may not abort at exactly the time limit imposed, but will abort as soon as it can do so safely.  This can happen when execution is in critical sections of certain built-in routines."

Then I tried 200 s. I watched the status bar time, which is very uneven, and jumped more than 100 s at some point. It seemed to freeze at 671 s for a long time. I used the stop icon, end it changed to gray but did not give the "computation interrupted" message. I tried to exit the worksheet, it asked me if I wanted to save and I was able to save and then exit.

In my experience, that is common behavior of the stop icon (even without timelimit).

So the timings were not correct, but nothing pathological was happenning (in the sense I had to use task manager). Here's the 100 s one.

solve_hangs_different_timing_dec_23_2022.mw

Right-click on the plot and choose "component properties" and you will find the name. (I tried cutting and pasting a plot to within a table and it did not change name.)

I put the populations into tables, indexed by the vertex names. Otherwise, you probably need member to extract the positions of the vertices in the list, which is awkward. You could also store the populations in Vertex attributes.
 

restart

NULL

with(GraphTheory)

with(SpecialGraphs)

Vs := [x, y, z, w]

[x, y, z, w]

Popvs := table(`~`[`=`](Vs, [-2, 1, 6, 3]))

table( [( x ) = -2, ( w ) = 3, ( y ) = 1, ( z ) = 6 ] )

X := Graph(Vs)

GRAPHLN(undirected, unweighted, [x, y, z, w], Array(1..4, {(1) = {}, (2) = {}, (3) = {}, (4) = {}}), `GRAPHLN/table/1`, 0)

AddEdge(X, {{w, y}, {w, z}, {x, y}, {y, z}})

GRAPHLN(undirected, unweighted, [x, y, z, w], Array(1..4, {(1) = {2}, (2) = {1, 3, 4}, (3) = {2, 4}, (4) = {2, 3}}), `GRAPHLN/table/1`, 0)

Nbs := map2(Neighbors, X, Vs)

[[y], [x, z, w], [y, w], [y, z]]

NULL

vp := [[0, 0], [1, 0], [1.5, 1], [2, 0]]

[[0, 0], [1, 0], [1.5, 1], [2, 0]]

SetVertexPositions(X, vp)``

DrawGraphWithPops := proc (X::Graph, pops::table) options operator, arrow; DrawGraph(RelabelVertices(X, map(convert, `~`[`=`](Vertices(X), convert(pops, list)), string))) end proc

DrawGraphWithPops(X, Popvs)

newPopvs := table(); for vert in Vs do newPopvs[vert] := Popvs[vert]+add(Popvs[j], `in`(j, Neighbors(X, vert))) end do

NULL``

DrawGraphWithPops(X, newPopvs)

NULL

``

Download Q_23-12-22_Test_Graph_indices2.mw

restart

with(GroupTheory); with(GraphTheory); with(plots)

n := 6; elements := [seq(PermPower(Perm([[`$`(1 .. n)]]), i), i = 1 .. n)]; Gp := Group(elements); IsCyclic(Gp)

6

[_m2697776930016, _m2697776924416, _m2697776924800, _m2697776925184, _m2697776925568, _m2697776925952]

_m2697776026688

true

Find all minimum combinations of elements that can generate the group.

Successively check cases with one generator, two generators, etc,
In order to avoid redundant generators, once a generator set is found, don't allow supersets.

gens:={}:
for numgens to n do
  combs:=combinat:-choose({$(1..n)},numgens):
  for gen in combs do
    if not ormap(`subset`, gens, gen)
       and AreIsomorphic(Gp,Group([seq(elements[i], i in gen)],degree=n)) then
      gens:=gens union {gen};
    end if;
  end do;
end do:
gens;

{{1}, {5}, {2, 3}, {3, 4}}

Generate and display Cayley graphs

CGs := seq(CayleyGraph(Gp, generators = [seq(elements[i], `in`(i, j))]), `in`(j, gens))

display(Array([seq(display(DrawGraph(CGs[j], style = circle), textplot([0, 1.1, gens[j]])), j = 1 .. nops(gens))]))

 

 

 

 

 

NULL

Download Generators.mw

 


 

restart;

eq1 := x = (((72*5^(3/2)+270)*a^2-1344*5^(3/2)*a)*w+(9*5^(5/2)-1485)*a^2-2016*5^(3/2)*a-12544*5^(5/2))/(((288*sqrt(5)+216)*a^2-5376*sqrt(5)*a)*w+(36*5^(3/2)-1188)*a^2-8064*sqrt(5)*a+6272*5^(3/2)):
eq2:= a^3 = -(128*5^(5/2)*w)/9+(1600*w)/3+(544*5^(3/2))/9+15200/27:
eq3:=1+w+w*w = 0:##   or w = (sqrt(3)*%i)/2-1/2:

ans:=simplify([solve({eq1,eq2,eq3},allsolutions,explicit)]);

[{a = (1/3)*((5*I)*5^(1/2)+5*I)*3^(1/2)+5^(1/2)-25/3, w = -1/2-((1/2)*I)*3^(1/2), x = -35/2-(15/2)*5^(1/2)}, {a = (1/3)*(-(4*I)*5^(1/2)+10*I)*3^(1/2)+2*5^(1/2)+20/3, w = -1/2-((1/2)*I)*3^(1/2), x = 5}, {a = (1/3)*(-I*5^(1/2)-15*I)*3^(1/2)-3*5^(1/2)+5/3, w = -1/2-((1/2)*I)*3^(1/2), x = -35/2+(15/2)*5^(1/2)}, {a = (1/3)*((4*I)*5^(1/2)-10*I)*3^(1/2)+2*5^(1/2)+20/3, w = -1/2+((1/2)*I)*3^(1/2), x = 5}, {a = (1/3)*(-(5*I)*5^(1/2)-5*I)*3^(1/2)+5^(1/2)-25/3, w = -1/2+((1/2)*I)*3^(1/2), x = -35/2-(15/2)*5^(1/2)}, {a = (1/3)*(I*5^(1/2)+15*I)*3^(1/2)-3*5^(1/2)+5/3, w = -1/2+((1/2)*I)*3^(1/2), x = -35/2+(15/2)*5^(1/2)}]

n:=nops(ans);

6

xvals:=seq(eval(x,i),i in ans);

-35/2-(15/2)*5^(1/2), 5, -35/2+(15/2)*5^(1/2), 5, -35/2-(15/2)*5^(1/2), -35/2+(15/2)*5^(1/2)

alias(a__1=((5*I*sqrt(5) + 5*I)*sqrt(3))/3 + sqrt(5) - 25/3,
a__2=((-4*I*sqrt(5) + 10*I)*sqrt(3))/3 + 2*sqrt(5) + 20/3,
a__3=((-sqrt(5)*I - 15*I)*sqrt(3))/3 - 3*sqrt(5) + 5/3,
a__4=((-5*I*sqrt(5) - 5*I)*sqrt(3))/3 + sqrt(5) - 25/3,
a__5=((4*I*sqrt(5) - 10*I)*sqrt(3))/3 + 2*sqrt(5) + 20/3,
a__6=((sqrt(5)*I + 15*I)*sqrt(3))/3 - 3*sqrt(5) + 5/3,
x__1=-35/2 - (15*sqrt(5))/2,
x__2=-35/2 + (15*sqrt(5))/2,
w__1=-1/2 - sqrt(3)*I/2,
w__2=-1/2 + sqrt(3)*I/2);

a__1, a__2, a__3, a__4, a__5, a__6, x__1, x__2, w__1, w__2

ans;

[{a = a__1, w = w__1, x = x__1}, {a = a__2, w = w__1, x = 5}, {a = a__3, w = w__1, x = x__2}, {a = a__5, w = w__2, x = 5}, {a = a__4, w = w__2, x = x__1}, {a = a__6, w = w__2, x = x__2}]

NULL

Download solns.mw

The answer to your immediate error is to add local gamma; after with(plots):

The rest of your worksheet has some problems. Firstly, parentheses () and square brackets [] have different meanings in Maple. You have both delta(w) and delta[w-1]. Since w appears to be an integer, it looks like you want to set some values into an Array or table; by default these are put into a table. Elsewhere it looks like you want to solve some recurrence equations? - see rsolve for that. If you are summing a finite number of things rather than wanting a general formula for a sum,use add, not sum. Perhaps explaining what you want to do would be useful.

First 35 36 37 38 39 40 41 Last Page 37 of 81