lcz

994 Reputation

11 Badges

6 years, 128 days
changsha, China

MaplePrimes Activity


These are questions asked by lcz

I want to simplify the following expression to 2a-2bk+k(n+6). But the following command is invalid.

algsubs(n2+n1=n+6,a+(n1-b)*k+a+(n2-b)*k);

 

However, the above expression can be simplified when k is fixed to a number, such as k=2.

algsubs(n2+n1=n+6,a+(n1-b)*2+a+(n2-b)*2);

I wonder what went wrong.

It seems to be recognized only if n1+ n2 is combined.

algsubs(n1+n2=n+6,simplify(a+(n1-b)*k+a+(n2-b)*k))

Recently I saw a heated discussion on this post:https://www.mapleprimes.com/questions/233026-Write-Output-Of-For-Loop-To-txt-File

In Carl Love  's answer, I felt the power of adjacency matrix of graph. I carefully read maple's function to generate non IsomorphicGraphs:  NonIsomorphicGraphs. There was one passage that I thought was really interesting.

selectform = graph, adjacency, or bits
This specifies the form used for a graph when it is being passed to the select procedure. The forms are identical to those for outputform, but note that adjacency and bits are the most efficient forms, while graph is only reasonable for a relatively small number of comparison operations (1000 or less), as it needs to form a Graph for every comparison. Note also that when selectform=adjacency the same read-only Matrix is internally used to pass the data for every call to reduce overhead. This is not possible with a Graph structure.

I never quite understood what the advantage of this bits was. At least according to the help documentation, we have  to do many works to do to convert this into a adjacency matrix of graph.

[NonIsomorphicGraphs(8, output = graphs, restrictto = regular[2])]

bit := Vector[row](Bits:-Split(210256131, bits = (8*(8 - 1))/2));
M := Matrix(8, 8, shape = symmetric, datatype = integer[1]);
M[1, 2 .. 8] := bit[1 .. 7];

M[2, 3 .. 8] := bit[8 .. 13];

M[3, 4 .. 8] := bit[14 .. 18];
M[4, 5 .. 8] := bit[19 .. 22];

M[5, 6 .. 8] := bit[23 .. 25];

M[6, 7 .. 8] := bit[26 .. 27];
M[7, 8 .. 8] := bit[28 .. 28];
M;

From adjacency matrix of graph,  we can diractly get a lot of information about the graph, like edges, and the number of closed walks of a particular length, but from bits , what imformation of graph we can get?

If we have to convert it to an adjacency matrix fist, maybe it's a little bit more complicated from above long codes. At least there isn't a more efficient way to convert?

I know that the "rotate" can rotate image of a function, but we see that the coordinate axes don't change as much. For example:

with(plots):
with(plottools):
p:=plot(sin(x),x=0..2*Pi):
r := rotate(p, Pi/4):display(p, r)

Although someone seems to have asked a similar question a long time ago, it was far from what I needed.

https://www.mapleprimes.com/questions/97812-Flip-Plot-Exchange-X-And-Yaxes

What I want to do is rotate the axes and the image at the same time rather than just flip axes.  The schematic diagram is as follows.

I drew a polygon using some point coordinates combined with the pointplot.

c1 := <0, -2>:
c2 := <1, 2>:
c3 := <2, 2>:
c4 := <0.5, 6>:
c5:=<1, 4>:
with(plots):
p1:=pointplot([c1, c2, c3, c4,c5, c1], color = red, connect = true);

I ‘d like to add  label  of endpoints to polygons, although I did this via textplot, but it didn't feel very neat. I hope when the polygon is drawn, labels of  every endpoints appear . These labels are the names of the assignment variable for the coordinates of the endpoints.

c1 := <0, -2>:
c2 := <1, 2>:
c3 := <2, 2>:
c4 := <0.5, 6>:
c5:=<1, 4>:
with(plots):

t1 :=textplot([0, -2, 'typeset'("c1")], 'align' = 'above'):
t2 :=textplot([1, 2, 'typeset'("c2")], 'align' = 'above'):
t3 :=textplot([2, 2, 'typeset'("c3")], 'align' = 'above'):
t4 :=textplot([0.5, 6, 'typeset'("c4")], 'align' = 'above'):
t5 :=textplot([1, 4, 'typeset'("c5")], 'align' = 'above'):
p1:=pointplot([c1, c2, c3, c4,c5, c1], color = red, connect = true):
display({p1, t1,t2,t3,t4,t5});

 

I think  DrawGraph command  in graph theory package  is very good to achieve this in a sense. 

In mathematica, CommunityGraphPlot attempts to draw the vertices grouped into communities. 

g = Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 
   3 \[UndirectedEdge] 4, 1 \[UndirectedEdge] 4, 
   1 \[UndirectedEdge] 5, 5 \[UndirectedEdge] 6, 
   5 \[UndirectedEdge] 7, 7 \[UndirectedEdge] 8, 
   8 \[UndirectedEdge] 9, 7 \[UndirectedEdge] 9}, 
  VertexLabels -> "Name"];
ged = {{6, 7, 8, 9}, {5}, {1, 2, 3, 4}};# Gallai-Edmonds decomposition
CommunityGraphPlot[
 HighlightGraph[g, FindIndependentEdgeSet[g], 
  GraphHighlightStyle -> "Thick"], 
 Thread[Labeled[ged, {"D(g)", "A(g)", "C(g)"}]], PlotTheme -> "Web"]

This function is very useful, for example, if I get a partition of vertices, such as the gallai-Edmonds decomposition below, I use  CommunityGraphPlot to easily see the overall layout of the graph. I don't know if Maple has a corresponding function.

PS: The Gallai-Edmonds decomposition of a graph g is the partition {D(g),A(g),C(g)} of its vertices, where D(g) consists of every vertex v for which there exists a maximum matching of g that misses v, A(g) consists of every vertex v that is not in D(g) but neighbors some vertex in D(g) and C(g) consists of all remaining vertices.
First 9 10 11 12 13 14 15 Last Page 11 of 25