Kitonum

21550 Reputation

26 Badges

17 years, 123 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Markiyan Hirnyk  You are right. Vote up. Your approach solves the problem for  n=7  for 1-2 minutes.

restart;

with(GraphTheory):

L := [NonIsomorphicGraphs(7, output = graphs, outputform = adjacency)]:

CodeTools[Usage](plots[display](Matrix(116,9, DrawGraph~(Graph~(L),style= circle))));

 

@Markiyan Hirnyk  I used your code for  n=5  and got a strange result (in Maple 2016.1):

restart;

with(GraphTheory):

L := [NonIsomorphicGraphs(5, output = graphs, outputform = adjacency)]:

seq(DrawGraph(Graph(c)), c = L);

                                    [Length of output exceeds limit of 1000000]

 

@Carl Love  Vote up. It is interesting that in earlier versions of Maple  IsIsomorphic  works properly for the case  n=4  also. I'm only slightly corrected your procedure, that there were no empty rows in your Matrix (for examples for cases  n=2 or n=4):

AllGraphs1:= proc(n::posint)

uses C= combinat, GT= GraphTheory, LT= ListTools, P= plots;

local 

     Gs:= map2(GT:-Graph, n, [C:-powerset(C:-choose({$1..n},2))[]]),

     NP:= plot(()-> 0, -1..1, color= white, axes= none),

     ng, ns;   

     Gs:= map(`?[]`, [LT:-Categorize(GT:-IsIsomorphic, Gs)], [1]);

     ng:= nops(Gs);

     ns:= ceil(evalf(sqrt(ng)));

     P:-display(Matrix(`if`(ng<=ns^2-ns,op([ns-1,ns]),ns), [GT:-DrawGraph~(Gs, style= circle)[], NP $ `if`(ng<=ns^2-ns,ns^2-ng-ns,ns^2-ng)]))    

end proc:

 

Example for n=4 (in Maple 16):

AllGraphs1(4);

             

 

 Addition.  See this link for the issue.

For some reason, this procedure in Maple 16  (for example for n=6)  is 2.5 times faster than in Maple 2016.1.

In Maple 16:

CodeTools[Usage](AllGraphs1(6));

memory used=6.11GiB, alloc change=0 bytes, cpu time=105.25s, real time=105.45s

 

In Maple 2016.1:

CodeTools[Usage](AllGraphs1(6));

memory used=11.29GiB, alloc change=96.00MiB, cpu time=4.65m, real time=4.77m, gc time=18.95s

 

@Markiyan Hirnyk  I meant my code, which works identically with   n=1..1  and without it:

plot3d([cos(t),sin(t),t], t=0..5*Pi, n=1..1, thickness=3, color=red, axes = frame, orientation = [-10, 75, 5], numpoints=10000);

@Markiyan Hirnyk  Yes, technically you're right. But the code works and it is interesting.

@Markiyan Hirnyk  An interesting technique! You are plotting a space curve by  plot3d  command. Here is my attempt of plotting a helix by this way. That's right, only unfortunately  color  option does not work:

plot3d([cos(t),sin(t),t], t=0..5*Pi, n=1..1, thickness=3, color=red, axes = frame, orientation = [-10, 75, 5], numpoints=10000);

                                   

 

 Convert your comment to an answer, so I could vote for it.

Addition:   n=1..1  can be omitted.

 

@wolfman29  I understand you. I just wanted to remind that the use of polar coordinates can help solve a problem in some cases, if other methods fail (of course with Maple).

@Carl Love  Vote up. These words  "with procedural input (for more-complicated models)"- very useful remark. For some reason I had never thought about why there is a procedural input.

PS. The model also works without  initialvalues= [375, 3, -7.5]

@jamunoz  This is only an example.

Another example - a random list, a broken line on its basis, then it is made smooth by a spline:

RandomTools[Generate](list(float(range=0...10, method=uniform), 20)):

L:=zip(`[]`,[$1..20],%):

plot(L, color=red, thickness=2, scaling=constrained):

plot(CurveFitting[Spline](L, x), x=1..20, color=red, thickness=2, scaling=constrained);

                    

 

 Carl, could this example be made by means of randpoly?

 

@viraj  You are wondering why a small change in the roots  t  to lead to significant changes in value of the function  P(t) . The reason is that the derivatives of the function  P(t)  at these points is very large, i.e. graph of the function  P(t)  is very steep, almost vertical. See

Digits:=100:

P:=-12116320194738194778134937600000000*t^26+167589596741213731838990745600000000*t^24+1058345691529498270472972795904000000*t^22-4276605572538658673086219419648000000*t^20-23240154739806540070988490473472000000*t^18-5442849111209103187871341215744000000*t^16+49009931453396028716875310432256000000*t^14+74247033158233643322704589225984000000*t^12-2762178990802317464801412907008000000*t^10-25947900993773120244883450232832000000*t^8-7468990043547273070742668836864000000*t^6-567730116675454293925108383744000000*t^4+3703566799705707258760396800000000*t^2-4742330812072533924249600000000:

Sol:=fsolve(P):

seq(evalf[3](eval(diff(P,t),t=s)),s=[Sol]);  # The derivatives of P(t) at the roots

.778e50, -.206e45, .111e41, -.417e38, .224e33, -.137e33, .137e33, -.224e33, .417e38, -.111e41, .206e45, -.778e50

@viraj   

-.25965814962389295505e-49, -.39367217335124e-55, -.4842468019e-59, .1022039e-62, -.1e-68, 0., 0., -.1e-68, .1022039e-62, -.4842468019e-59, -.39367217335124e-55, -.25965814962389295505e-49

These numbers are not roots but values of the polynomial  P  in the points coinciding with found roots. As it should be, these numbers are close to zero.    

@Prof. j. smith  Remove  minimize  option, it causes an error .

An example:

Optimization:-NLPSolve(sin,-Pi..Pi, minimize);

Optimization:-NLPSolve(sin,-Pi..Pi);

 

 

 

@Markiyan Hirnyk  I do not think that your animation with  Explore  command can be easily made by  plots:-display(..., insequence)  or  plots:=animate   command. The problem is that all the frames have a coordinate system with the same ranges  (view  option does not work). See 

plots[display](seq(plot([x^2, 2*x-1], x = 1-a .. 1+a, view = [1-a .. 1+a, (1-a)^2 .. (1+a)^2]), a = 1.0 .. 0.01, -0.01), insequence);

                             

 

 

 

@one man  I quite understand you.  Alsu, vote up from me.

 

PS: Markiyan, it's interesting, but unfortunately Alsu has only  Maple 12.

@Preben Alsholm   

Unfortunately for the slightly larger number  x = 10 ^ 8 , this approach does not work:

f:=x->(1+1/x)^x;

f(10^8);

evalf(%);

             Error, (in f) numeric exception: overflow

First 76 77 78 79 80 81 82 Last Page 78 of 133