dharr

Dr. David Harrington

8270 Reputation

22 Badges

20 years, 357 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

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.

The solution provided is a partial solution. Maple has managed to reduce your third order de to a second order one which it can't solve in the general case. So I doubt it can be reduced to a first order one.

When you specified the initial condition v(0)=C1, Maple did solve it and gave you the solution v(y)=C1 for all y. If you use odetest, it will verify that is a correct solution. Maybe not the one you wanted. You need to specify a first and second derivative at 0 as well. If you just choose C2 and C3 for these, Maple doesn't find a solution. Perhaps it can find a solution for some special values, but in my experience Maple can find a partial or general solution more easily than it can find one with conditions. 

Maple has a bunch of tools in the DEtools package to perhaps find an analytical solution if you know something about differential equations. Otherwise, a numerical solution may work for you.

% on its own gives the last expression as you say. That is unrelated to putting % in front of (many) things, which makes them inert. So %. is inert matrix multiplication - not evaluated until you use value - see examples in attached.

Download inert.mw

 

Maplecloud could be used for this. However, most journals allow supplementary information with the online version of an article, which can include Maple worksheets.

M := ExcelTools:-Import(cat(currentdir(), "/Data.xlsx"))

Generates a Matrix from the whole file. You can also specific a selection to import. The Matrix can be split into columns in various ways, depending on the names you want and what sort of variable. For example, for the first column as a Vector.

tim:=M[..,1];

To put 10 columns into variables x1,...x10

cat(x, 1 .. 10) := LinearAlgebra:-Column(M, 1 .. 10)

 

Using 

disk([x0,y0],0.06,color=black)

from the plottools package is clearer, both on the screen and in the .pdf export. I tried to find the reason by exporting to .eps and looking more closely in Coreldraw, but then they look the same, so the export process must work differently.

Following up on @acer's, suggestion, the following appears to work, but I'll let you check the bits to see if they are correct.

Download float.mw

Use

fprintf(fd,"%a",u11);
close(fd);

Edit: If you need the "u11:=", then that is

fprintf(fd,"u11:=%a",u11);
close(fd);

I interpret your x1prime as a derivative with respect to time, and assume the partial derivatives don't depend explicitly on time. Then the equations you give aren't really relevant, and something like the following works.

de1:=diff(H(x,y),x)=2*x*y^3;
de2:=diff(H(x,y),y)=3*x^2*y^2;
pdsolve({de1,de2});

{H(x, y) = x^2*y^3+_C1}

Download pdsolve.mw

The inttrans package in my version of Maple (2015) does not work this one out, but it can be worked out step by step using Cauchy's residue theorem.

Edit: redone to use strict upper half plane.

Download Fourier.mw

Here I read the whole file in as a string and then process it (including removing all the spaces). If you really have huge files, then reading line by line as in @mmcdara's answer is superior. But either way, I think the use of sscanf or fscanf helps.

readdata.mw

 

How about

foo:=proc(n::integer);
  if n=0 then
     return FAIL
  else
     return 1,2;
  fi;
end proc:
L:=foo(6);
if L<>FAIL then
  A,B:=L;
end if;

This also works if you return a list and use A,B:=L[]; 

If you really like the call form a,b:=foo(), then you could just return FAIL,FAIL and test A for FAIL.

First 36 37 38 39 40 41 42 Last Page 38 of 82