Kitonum

21435 Reputation

26 Badges

17 years, 28 days

MaplePrimes Activity


These are replies submitted by Kitonum

@vv Thank you. Unfortunately your code does not work on my computer for some reason:

Only with the option  compile=false  I get the result, but the time is 10 times longer.

When I wrote about my method for 100 seconds, I used another technique (uncompiled code). I'll submit this code later.

@tsunamiBTP  I did this and did not find any fundamental discrepancies. Some differences are due to the fact that in  M_new  I am greatly rounding the results (evalf[3]). For comparison, I calculated the hundredth line of my and your matrix. The graphs are indistinguishable. See untitled5_new2.mw

@John Fredsted  About this construction see Matrix and Vector Construction Shortcuts help page. By the same method, we can remove from a matrix any row or several rows or columns:

A:=LinearAlgebra:-RandomMatrix(6, generator=0..9);
A1:=<A[..3], A[5..]>;  
# 4th row deleted of A
A2:=<A[..,..4] | A[..,6]>;  
# 5th column deleted of A


I think this method is faster than calling  LinearAlgebra:-DeleteRow  or  LinearAlgebra:-DeleteColumn .

@tsunamiBTP  See corrected file  untitled5_new1.mw 

@tsunamiBTP  You wrote "This seems to work like a nested FOR loop". No, these are the different things. Here is a simple example of use nested seq. Let's say you want to create a matrix 10x10 that has symbols  x1, x2, ... ,x10  in the first line, the second line contains the same symbols, which squared, then cubed and so on:

Matrix([seq([seq((x||j)^i, j=1..10)], i=1..10)]);


Another example. It is very convenient and effective to use  seq  command  to obtain the sequence or list of objects with specified properties. In the example, we generate the sequence of Pythagorean triplets with  hypotenuses <=100:

seq(seq(seq(`if`(a^2+b^2=c^2,[a,b,c],NULL), b=a+1..c-1), a=1..c-2), c=3..100);

[3, 4, 5], [6, 8, 10], [5, 12, 13], [9, 12, 15], [8, 15, 17], [12, 16, 20], [7, 24, 25], [15, 20, 25], [10, 24, 26], [20, 21, 29], [18, 24, 30], [16, 30, 34], [21, 28, 35], [12, 35, 37], [15, 36, 39], [24, 32, 40], [9, 40, 41], [27, 36, 45], [14, 48, 50], [30, 40, 50], [24, 45, 51], [20, 48, 52], [28, 45, 53], [33, 44, 55], [40, 42, 58], [36, 48, 60], [11, 60, 61], [16, 63, 65], [25, 60, 65], [33, 56, 65], [39, 52, 65], [32, 60, 68], [42, 56, 70], [48, 55, 73], [24, 70, 74], [21, 72, 75], [45, 60, 75], [30, 72, 78], [48, 64, 80], [18, 80, 82], [13, 84, 85], [36, 77, 85], [40, 75, 85], [51, 68, 85], [60, 63, 87], [39, 80, 89], [54, 72, 90], [35, 84, 91], [57, 76, 95], [65, 72, 97], [28, 96, 100], [60, 80, 100]

 

@Markiyan Hirnyk  Here is a check (I just added a few commands to your document):


 

restart; ListTools:-FlattenOnce(convert(Vector(50, {(1) = 111111111111111111111111111111111111111111111111111111111111111111111111111111, (2) = 111111111111111111111111111111116000808880608061111111111111111111111111111111, (3) = 111111111111111111111111111866880886008008088868888011111111111111111111111111, (4) = 111111111111111111111116838888888801111111188006080011111111111111111111111111, (5) = 111111111111111111110808080811111111111111111111111118860111111111111111111111, (6) = 111111111111111110086688511111111111111111111111116688888108881111111111111111, (7) = 111111111111111868338111111111111111111111111111880806086100808811111111111111, (8) = 111111111111183880811111111111111111100111111888580808086111008881111111111111, (9) = 111111111111888081111111111111111111885811188805860686088111118338011111111111, (10) = 111111111188008111111111111111111111888888538888800806506111111158500111111111, (11) = 111111111883061111111111111111111116580088863600880868583111111118588811111111, (12) = 111111118688111111111001111111111116880850888608086855358611111111100381111111, (13) = 111111160831111111110880111111111118080883885568063880505511111111118088111111, (14) = 111111588811111111110668811111111180806800386888336868380511108011111006811111, (15) = 111111111088600008888688861111111108888088058008068608083888386111111108301111, (16) = 111116088088368860808880860311111885308508868888580808088088681111111118008111, (17) = 111111388068066883685808808331111808088883060606800883665806811111111116800111, (18) = 111581108058668300008500368880158086883888883888033038660608111111111111088811, (19) = 111838110833680088080888568608808808555608388853680880658501111111111111108011, (20) = 118008111186885080806603868808888008000008838085003008868011111111111111186801, (21) = 110881111110686850800888888886883863508088688508088886800111111111111111118881, (22) = 183081111111665080050688886656806600886800600858086008831111111111111111118881, (23) = 186581111111868888655008680368006880363850808888880088811111111111111111110831, (24) = 168881111118880838688806888806880885088808085888808086111111111111111111118831, (25) = 188011111008888800380808588808068083868005888800368806111111111111111111118081, (26) = 185311111111380883883650808658388860008086088088000868866808811111111111118881, (27) = 168511111111111180088888686580088855665668308888880588888508880800888111118001, (28) = 188081111111111111508888083688033588663803303686860808866088856886811111115061, (29) = 180801111111111111006880868608688080668888380580080880880668850088611111110801, (30) = 188301111111111110000608808088360888888308685380808868388008006088111111116851, (31) = 118001111111111188080580686868000800008680805008830088080808868008011111105001, (32) = 116800111111118888803380800830868365880080868666808680088685660038801111180881, (33) = 111808111111100888880808808660883885083083688883808008888888386880005011168511, (34) = 111688811111111188858888088808008608880856000805800838080080886088388801188811, (35) = 111138031111111111111110006500656686688085088088088850860088888530008888811111, (36) = 111106001111111111111111110606880688086888880306088008088806568000808508611111, (37) = 111118000111111111111111111133888000508586680858883868000008801111111111111111, (38) = 111111860311111111111111111108088888588688088036081111860803011111111863311111, (39) = 111111188881111111111111111100881111160386085000611111111888811111108833111111, (40) = 111111118888811111111111111608811111111188680866311111111111811111888861111111, (41) = 111111111688031111111111118808111111111111188860111111111111111118868811111111, (42) = 111111111118850811111111115861111111111111111888111111111111111080861111111111, (43) = 111111111111880881111111108051111111111111111136111111111111188608811111111111, (44) = 111111111111116830581111008011111111111111111118111111111116880601111111111111, (45) = 111111111111111183508811088111111111111111111111111111111088880111111111111111, (46) = 111111111111111111600010301111111111111111111111111111688685811111111111111111, (47) = 111111111111111111111110811801111111111111111111158808806881111111111111111111, (48) = 111111111111111111111181110888886886338888850880683580011111111111111111111111, (49) = 111111111111111111111111111008000856888888600886680111111111111111111111111111, (50) = 111111111111111111111111111111111111111111111111111111111111111111111111111111}), list))

[111111111111111111111111111111111111111111111111111111111111111111111111111111, 111111111111111111111111111111116000808880608061111111111111111111111111111111, 111111111111111111111111111866880886008008088868888011111111111111111111111111, 111111111111111111111116838888888801111111188006080011111111111111111111111111, 111111111111111111110808080811111111111111111111111118860111111111111111111111, 111111111111111110086688511111111111111111111111116688888108881111111111111111, 111111111111111868338111111111111111111111111111880806086100808811111111111111, 111111111111183880811111111111111111100111111888580808086111008881111111111111, 111111111111888081111111111111111111885811188805860686088111118338011111111111, 111111111188008111111111111111111111888888538888800806506111111158500111111111, 111111111883061111111111111111111116580088863600880868583111111118588811111111, 111111118688111111111001111111111116880850888608086855358611111111100381111111, 111111160831111111110880111111111118080883885568063880505511111111118088111111, 111111588811111111110668811111111180806800386888336868380511108011111006811111, 111111111088600008888688861111111108888088058008068608083888386111111108301111, 111116088088368860808880860311111885308508868888580808088088681111111118008111, 111111388068066883685808808331111808088883060606800883665806811111111116800111, 111581108058668300008500368880158086883888883888033038660608111111111111088811, 111838110833680088080888568608808808555608388853680880658501111111111111108011, 118008111186885080806603868808888008000008838085003008868011111111111111186801, 110881111110686850800888888886883863508088688508088886800111111111111111118881, 183081111111665080050688886656806600886800600858086008831111111111111111118881, 186581111111868888655008680368006880363850808888880088811111111111111111110831, 168881111118880838688806888806880885088808085888808086111111111111111111118831, 188011111008888800380808588808068083868005888800368806111111111111111111118081, 185311111111380883883650808658388860008086088088000868866808811111111111118881, 168511111111111180088888686580088855665668308888880588888508880800888111118001, 188081111111111111508888083688033588663803303686860808866088856886811111115061, 180801111111111111006880868608688080668888380580080880880668850088611111110801, 188301111111111110000608808088360888888308685380808868388008006088111111116851, 118001111111111188080580686868000800008680805008830088080808868008011111105001, 116800111111118888803380800830868365880080868666808680088685660038801111180881, 111808111111100888880808808660883885083083688883808008888888386880005011168511, 111688811111111188858888088808008608880856000805800838080080886088388801188811, 111138031111111111111110006500656686688085088088088850860088888530008888811111, 111106001111111111111111110606880688086888880306088008088806568000808508611111, 111118000111111111111111111133888000508586680858883868000008801111111111111111, 111111860311111111111111111108088888588688088036081111860803011111111863311111, 111111188881111111111111111100881111160386085000611111111888811111108833111111, 111111118888811111111111111608811111111188680866311111111111811111888861111111, 111111111688031111111111118808111111111111188860111111111111111118868811111111, 111111111118850811111111115861111111111111111888111111111111111080861111111111, 111111111111880881111111108051111111111111111136111111111111188608811111111111, 111111111111116830581111008011111111111111111118111111111116880601111111111111, 111111111111111183508811088111111111111111111111111111111088880111111111111111, 111111111111111111600010301111111111111111111111111111688685811111111111111111, 111111111111111111111110811801111111111111111111158808806881111111111111111111, 111111111111111111111181110888886886338888850880683580011111111111111111111111, 111111111111111111111111111008000856888888600886680111111111111111111111111111, 111111111111111111111111111111111111111111111111111111111111111111111111111111]

(1)

cat(%[]);

`111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111116000808880608061111111111111111111111111111111111111111111111111111111111866880886008008088868888011111111111111111111111111111111111111111111111116838888888801111111188006080011111111111111111111111111111111111111111111110808080811111111111111111111111118860111111111111111111111111111111111111110086688511111111111111111111111116688888108881111111111111111111111111111111868338111111111111111111111111111880806086100808811111111111111111111111111183880811111111111111111100111111888580808086111008881111111111111111111111111888081111111111111111111885811188805860686088111118338011111111111111111111188008111111111111111111111888888538888800806506111111158500111111111111111111883061111111111111111111116580088863600880868583111111118588811111111111111118688111111111001111111111116880850888608086855358611111111100381111111111111160831111111110880111111111118080883885568063880505511111111118088111111111111588811111111110668811111111180806800386888336868380511108011111006811111111111111088600008888688861111111108888088058008068608083888386111111108301111111116088088368860808880860311111885308508868888580808088088681111111118008111111111388068066883685808808331111808088883060606800883665806811111111116800111111581108058668300008500368880158086883888883888033038660608111111111111088811111838110833680088080888568608808808555608388853680880658501111111111111108011118008111186885080806603868808888008000008838085003008868011111111111111186801110881111110686850800888888886883863508088688508088886800111111111111111118881183081111111665080050688886656806600886800600858086008831111111111111111118881186581111111868888655008680368006880363850808888880088811111111111111111110831168881111118880838688806888806880885088808085888808086111111111111111111118831188011111008888800380808588808068083868005888800368806111111111111111111118081185311111111380883883650808658388860008086088088000868866808811111111111118881168511111111111180088888686580088855665668308888880588888508880800888111118001188081111111111111508888083688033588663803303686860808866088856886811111115061180801111111111111006880868608688080668888380580080880880668850088611111110801188301111111111110000608808088360888888308685380808868388008006088111111116851118001111111111188080580686868000800008680805008830088080808868008011111105001116800111111118888803380800830868365880080868666808680088685660038801111180881111808111111100888880808808660883885083083688883808008888888386880005011168511111688811111111188858888088808008608880856000805800838080080886088388801188811111138031111111111111110006500656686688085088088088850860088888530008888811111111106001111111111111111110606880688086888880306088008088806568000808508611111111118000111111111111111111133888000508586680858883868000008801111111111111111111111860311111111111111111108088888588688088036081111860803011111111863311111111111188881111111111111111100881111160386085000611111111888811111108833111111111111118888811111111111111608811111111188680866311111111111811111888861111111111111111688031111111111118808111111111111188860111111111111111118868811111111111111111118850811111111115861111111111111111888111111111111111080861111111111111111111111880881111111108051111111111111111136111111111111188608811111111111111111111111116830581111008011111111111111111118111111111116880601111111111111111111111111111183508811088111111111111111111111111111111088880111111111111111111111111111111111600010301111111111111111111111111111688685811111111111111111111111111111111111111110811801111111111111111111158808806881111111111111111111111111111111111111111181110888886886338888850880683580011111111111111111111111111111111111111111111111111008000856888888600886680111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111`

(2)

isprime(parse(%));

true

(3)

``


 

Download Check.mw

 

@mehdibaghaee Sorry, I did not notice the second condition.
Should be:

seq(`if`(V[i]>0 and V[i]<>infinity, [i, V[i]], NULL), i=1..10);

@Preben Alsholm

For example, if we have a function of one variable, given explicitly  f:=x->f(x)  and we want to  calculate the derivative value at a point  x=x0 , then I think that  D(f)(x0)  is better than  eval(diff(f(x),x), x=x0)  or  unapply(diff(f(x),x), x)(x0) .

@Preben Alsholm 

D operator can be used in similar situations, only the function must be specified explicitly:

restart;
f:=(x,y)->(x^3+y^3)^(1/3);
r:=(s,t)->(s*sin(t), s+56);
D[1](unapply((f@r)(s,t), s,t));

 

@tsunamiBTP

1. Since you mentioned  plottools:-getdata  command, I understood your request as a desire to get data from the plot.

2. If you want to get data from the second your graph, write:

data := op([2, 1], P);  # data as a matrix
convert(data, listlist);   # data as a list of lists

@Carl Love  For greater clarity, you can add one row to the final matrix:

<< x(`in degrees`) | sin(x) | Error> ;  < d | S | Err >>;

@tomleslie   I understood this condition  0<= beta, delta <= 1, that both roots should be searched in the range 0..1. If we follow your understanding, then here are 4 plots (I used to believe my eyes). The first two graphs clearly show the roots that are not in the list of DirectSearch. The last 2 plots show that the last 2 solutions of DirectSearch are wrong.

plots:-implicitplot([focdeltapioptS2Tbeta_eg, focbetapioptS2Tbeta_eg], beta=0..2, delta=-20..1, color=[red,blue], thickness=2,  gridrefine=5, axes=normal);

plots:-implicitplot([focdeltapioptS2Tbeta_eg, focbetapioptS2Tbeta_eg], beta=0.99..1.01, delta=-50..1, color=[red,blue], thickness=2,  gridrefine=5, axes=normal);

plots:-implicitplot([focdeltapioptS2Tbeta_eg, focbetapioptS2Tbeta_eg], beta=10.8..11, delta=-2.2..-2, color=[red,blue], thickness=2,  gridrefine=5, axes=normal);

plots:-implicitplot([focdeltapioptS2Tbeta_eg, focbetapioptS2Tbeta_eg], beta=14.7..14.9, delta=0.9..1.1, color=[red,blue], thickness=2,  gridrefine=5, axes=normal);
 

 

@Wtolrud  You can use a simple procedure named  Sort  that sorts any polynomial in ascending order of degrees. Formal parameters of the procedure: P is a polynomial (possibly with symbolic coefficients), var is a polynomial variable (by default this is x):

Sort:=proc(P::polynom, var::name:=x)
sort(P, var, ascending);
end proc:


Examples of use:

Sort(a*x^2+b*x+c);
Sort(-3*t^3+t+2*t^2+5, t);

                                   c+b*x+a*x^2
                                 5+t+2*t^2-3*t^3
 

 

 

@omkardpd  Place your specific system here in a copyable form as a text (not as a picture).

You forgot the sign of multiplication. Should be:

5*x^3+7*x^2+2*x^3

 

First 59 60 61 62 63 64 65 Last Page 61 of 132