Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am unable to the get the output  in ans2 , error is comming

 

restart:
with(DETools):
with(PDEtools):
u[o](r,z):=(-1/4)*diff(p[o](z),z)*(1-r^2):
ode:=gamma1*diff(u[o](r,z),z)+(1/r)*diff(v[1](r)*r,r)=0:
#dsolve( (ode), { v[1](r) } ):
IC1 := {v[1](0) = 0}:
ans2 := combine(dsolve(`union`(ode, IC1),{v[1](r)}));
 

Hi, I have a long expression (differential polynomial).

It may contain different functions a(x,y), b(x,y), c(x,y) and its derrivatives.

Visually i do not see variable a (and its derivative) in expression.

But I want to be sure. How can I check it automatically?

Also I don't know maximal order of derivative that could appear in this expression.

Hello!

Assume we have the first N positive integres, 1,..,N, and we assing to these numbers a (discrete) probability distribution p1,...,pN. Of course, p1+...+pN=1.

Then, How can we select a number in {1,..,N} according to the given probability distribution? That is, the number 1 can be chosen with probability p1, 2 with a probability p2, etc.

Many thanks in advance for your comments.

Hi,

I am collecting the coefficients of funciton terms(like sin, cos, log,exp,abs) form the expression. I was able to collect using the function 'coeff'. Initially am getting all functions in the expression using Indets[flat(expression, funciton)] then using seq and coeff trying to get all funcitons

expression := a*sin((a+b)/(a-b))*log(a/b)/c+a*b/c+2*sin(a+b);
numOfFuncs := numelems(indets[flat](expression, function));
Funcs := convert(indets[flat](Expression, function), list);

funcCoeffList := [seq(coeff(Expression, Funcs[i]), i = 1 .. numOfFuncs )];

funcCoeffList := [a*sin((a+b)/(a-b))/c, a*ln(a/b)/c, 2]

When there are terms of form funtion*function I would like to collect the coefficient for function*function as one term rather than two terms. simply I want to write a code which reads the functions having product between them as one term gives me back the coefficient.

Looking for the output as : [a/c,2] or [a/c,1,2];

Hello

I have an expression which invokes the LambertW function.

LambertW(-ln(1+i)*EP*p*(1+i)^(-(365*EP*hr*kw*p+SC*i)/(365*FIT*hr*i*kw*(-1+p)))/(FIT*i*(-1+p)))

I was trying to import this expression into Excel, but my version doesn't have LambertW.

Does someone know an analagous function in a form Excel can compute?

According to wiki The Lambert W relation cannot be expressed in terms of elementary functions.

I have gotten around the problem using Newton-Raphson method, but it takes a few cells to converge....

 

how i can remove root of from result.

I want to plot function.

Thnaks

root_of.mw
 

sigma2 := RootOf(43980465111040000000000000000*sqrt(3)*Pi^25*sqrt(32*Pi^2+2)*sigma+21990232555520000000000000000*sqrt(3)*Pi^23*sqrt(32*Pi^2+2)*sigma-98268851732480000000000000000*sqrt(3)*Pi^21*sqrt(32*Pi^2+2)*sigma-44495861186560000000000000000*sqrt(3)*Pi^19*sqrt(32*Pi^2+2)*sigma+82188225740800000000000000000*sqrt(3)*Pi^17*sqrt(32*Pi^2+2)*sigma+33095407370240000000000000000*sqrt(3)*Pi^15*sqrt(32*Pi^2+2)*sigma-30136000839680000000000000000*sqrt(3)*Pi^13*sqrt(32*Pi^2+2)*sigma-10618895073280000000000000000*sqrt(3)*Pi^11*sqrt(32*Pi^2+2)*sigma+3822293002240000000000000000*sqrt(3)*Pi^9*sqrt(32*Pi^2+2)*sigma+1210118016000000000000000000*sqrt(3)*Pi^7*sqrt(32*Pi^2+2)*sigma+118805400000000000000000000*sqrt(3)*Pi^5*sqrt(32*Pi^2+2)*sigma+5028750000000000000000000*sqrt(3)*Pi^3*sqrt(32*Pi^2+2)*sigma+79101562500000000000000*sqrt(3)*sigma*Pi*sqrt(32*Pi^2+2)+111484894360500000*Pi^2*20^RootOf8+1765920726670320000*Pi^4*20^RootOf8-569534208772147200*Pi^6*20^RootOf8-4505569481375428608*Pi^8*20^RootOf8+972005049637797888*Pi^10*20^RootOf8+5143616921914048512*Pi^12*20^RootOf8-554194415829123072*Pi^14*20^RootOf8-2216777663316492288*Pi^16*20^RootOf8+(-9231519020818020433920000000000*Pi^22+195541371952408496701440000000000*Pi^20+89300299589267320995840000000000*Pi^18-333503605675043554590720000000000*Pi^16-115500365322956203622400000000000*Pi^14+204706142659640339988480000000000*Pi^12+55783620627641021399040000000000*Pi^10-43454880575740151285760000000000*Pi^8-9286786763553830541120000000000*Pi^6-635208422610519981000000000000*Pi^4-16054449064166199375000000000*Pi^2-85686765999732421875000000)*_Z+(1683627180032000000000000000000*Pi^28+947040288768000000000000000000*Pi^26-243897798836910985052160000000000*Pi^24-105849518880314282213376000000000*Pi^22+543806205557386676011008000000000*Pi^20+206745517628405562998784000000000*Pi^18-493535946568048375234560000000000*Pi^16-161556685841710476165120000000000*Pi^14+209521703041307302907904000000000*Pi^12+57932333046211895115008000000000*Pi^10-32606166808014116503296000000000*Pi^8-7574931806403147431400000000000*Pi^6-916854325001083153125000000000*Pi^4-60848666758777034179687500000*Pi^2-1531121744500488281250000000)*_Z^2+(14538675656595603456000000000000*Pi^20+6360670599760576512000000000000*Pi^18-24363640065154351104000000000000*Pi^16-9459367828326973440000000000000*Pi^14+10040437028153917440000000000000*Pi^12+3693930616897744896000000000000*Pi^10+1609933205706216192000000000000*Pi^8+58674582771546096000000000000*Pi^6-1202653471578517170000000000000*Pi^4-149668239567146343750000000000*Pi^2-4663745768352832031250000000)*_Z^3+(-8723205391669003498291200000000*Pi^24-4361602695834501749145600000000*Pi^22+19490912047010429691494400000000*Pi^20+8825430454852624633036800000000*Pi^18-16301436833461042151424000000000*Pi^16-6564233354119088386867200000000*Pi^14+5977256592087501137510400000000*Pi^12+2106180608207148770918400000000*Pi^10-758124018049754123827200000000*Pi^8-240018107472837924480000000000*Pi^6-23564187036740637000000000000*Pi^4-997415989180706250000000000*Pi^2-15689219628471679687500000)*_Z^4-13647882752248245117187500000-261292721157421875*20^RootOf8-535230827832343213125000000000*Pi^2-90526382422649463214540800000000*Pi^8-18587959930253464168320000000000*Pi^6-5863377073505044924800000000000*Pi^4+305811336261213249011712000000000*Pi^12+79115470702645314657484800000000*Pi^10-239241111641945951698944000000000*Pi^16-79895480796476508576153600000000*Pi^14+7986315188014109687808000000000*Pi^22-60346149989113268482867200000000*Pi^20-18258684357505568263372800000000*Pi^18+14855623787650488886886400000000*Pi^24)

F := plot([sigma2], sigma = -10 .. 10, color = [RED], thickness = 1)

Warning, expecting only range variable sigma in expression RootOf(-2216777663316492288*Pi^16*20^RootOf8-554194415829123072*Pi^14*20^RootOf8+5143616921914048512*Pi^12*20^RootOf8+33095407370240000000000000000*3^(1/2)*Pi^15*(32*Pi^2+2)^(1/2)*sigma-30136000839680000000000000000*3^(1/2)*Pi^13*(32*Pi^2+2)^(1/2)*sigma+5028750000000000000000000*3^(1/2)*Pi^3*(32*Pi^2+2)^(1/2)*sigma+79101562500000000000000*3^(1/2)*sigma*Pi*(32*Pi^2+2)^(1/2)-10618895073280000000000000000*3^(1/2)*Pi^11*(32*Pi^2+2)^(1/2)*sigma+3822293002240000000000000000*3^(1/2)*Pi^9*(32*Pi^2+2)^(1/2)*sigma+1210118016000000000000000000*3^(1/2)*Pi^7*(32*Pi^2+2)^(1/2)*sigma+118805400000000000000000000*3^(1/2)*Pi^5*(32*Pi^2+2)^(1/2)*sigma+43980465111040000000000000000*3^(1/2)*Pi^25*(32*Pi^2+2)^(1/2)*sigma+21990232555520000000000000000*3^(1/2)*Pi^23*(32*Pi^2+2)^(1/2)*sigma-98268851732480000000000000000*3^(1/2)*Pi^21*(32*Pi^2+2)^(1/2)*sigma-44495861186560000000000000000*3^(1/2)*Pi^19*(32*Pi^2+2)^(1/2)*sigma+82188225740800000000000000000*3^(1/2)*Pi^17*(32*Pi^2+2)^(1/2)*sigma+14855623787650488886886400000000*Pi^24-18587959930253464168320000000000*Pi^6-5863377073505044924800000000000*Pi^4+79115470702645314657484800000000*Pi^10-90526382422649463214540800000000*Pi^8-239241111641945951698944000000000*Pi^16-79895480796476508576153600000000*Pi^14+305811336261213249011712000000000*Pi^12-60346149989113268482867200000000*Pi^20-18258684357505568263372800000000*Pi^18+7986315188014109687808000000000*Pi^22-535230827832343213125000000000*Pi^2+111484894360500000*Pi^2*20^RootOf8+1765920726670320000*Pi^4*20^RootOf8-569534208772147200*Pi^6*20^RootOf8-4505569481375428608*Pi^8*20^RootOf8+972005049637797888*Pi^10*20^RootOf8+(-9231519020818020433920000000000*Pi^22+195541371952408496701440000000000*Pi^20+89300299589267320995840000000000*Pi^18-333503605675043554590720000000000*Pi^16-115500365322956203622400000000000*Pi^14+204706142659640339988480000000000*Pi^12+55783620627641021399040000000000*Pi^10-43454880575740151285760000000000*Pi^8-9286786763553830541120000000000*Pi^6-635208422610519981000000000000*Pi^4-16054449064166199375000000000*Pi^2-85686765999732421875000000)*_Z+(1683627180032000000000000000000*Pi^28+947040288768000000000000000000*Pi^26-243897798836910985052160000000000*Pi^24-105849518880314282213376000000000*Pi^22+543806205557386676011008000000000*Pi^20+206745517628405562998784000000000*Pi^18-493535946568048375234560000000000*Pi^16-161556685841710476165120000000000*Pi^14+209521703041307302907904000000000*Pi^12+57932333046211895115008000000000*Pi^10-32606166808014116503296000000000*Pi^8-7574931806403147431400000000000*Pi^6-916854325001083153125000000000*Pi^4-60848666758777034179687500000*Pi^2-1531121744500488281250000000)*_Z^2+(14538675656595603456000000000000*Pi^20+6360670599760576512000000000000*Pi^18-24363640065154351104000000000000*Pi^16-9459367828326973440000000000000*Pi^14+10040437028153917440000000000000*Pi^12+3693930616897744896000000000000*Pi^10+1609933205706216192000000000000*Pi^8+58674582771546096000000000000*Pi^6-1202653471578517170000000000000*Pi^4-149668239567146343750000000000*Pi^2-4663745768352832031250000000)*_Z^3+(-8723205391669003498291200000000*Pi^24-4361602695834501749145600000000*Pi^22+19490912047010429691494400000000*Pi^20+8825430454852624633036800000000*Pi^18-16301436833461042151424000000000*Pi^16-6564233354119088386867200000000*Pi^14+5977256592087501137510400000000*Pi^12+2106180608207148770918400000000*Pi^10-758124018049754123827200000000*Pi^8-240018107472837924480000000000*Pi^6-23564187036740637000000000000*Pi^4-997415989180706250000000000*Pi^2-15689219628471679687500000)*_Z^4-13647882752248245117187500000-261292721157421875*20^RootOf8) to be plotted but found name RootOf8

 

``


 

Download root_of.mw

 

Hi, I'm using Maple 2018 and I tried to run coding from https://www.maplesoft.com/applications/view.aspx?sid=4194&view=html

however, it said : unable to parse. I figured out that the problem maybe is in the if loop. though it seems perfectly fine, but it has some goto commands that i cannot search on maple website. does this mean that the goto cannot be used here and should be replaced? if yes, then how? 

i am still learning on how to use maple. any help would be much appreciated. thank you!

this is the coding for if loop:

 

label_7;

rv:=vector([p1(x1pt,x2pt),p2(x1pt,x2pt)]):

numgeval:=numgeval+1;

printf("%5d (%8.4f,%8.4f)",numIter,rv[1],rv[2]);

max:=n;

mg:=convert(sqrt(dotprod(rv,rv)),float);

printf("%12.4f",mg);

if(mg<tol or numIter>=max) then

goto(label_6);

else

numIter:=numIter+1;

fi;

v1:=x1pt+t*rv[1];

v2:=x2pt+t*rv[2];

newt:=evalf(subs({x1=v1,x2=v2},f1));

numfeval:=numfeval+1;

lam:=fsolve(diff(newt,t)=0,t,maxsols=1);

nv1:=evalf(subs({t=lam},v1));

nv2:=evalf(subs({t=lam},v2));

printf(" (%8.4f,%8.4f)%13.4f\n",x1pt,x2pt,lam);

x1pt:=nv1;

x2pt:=nv2;

goto(label_7);

label_6;

printf("\n\n-----------------------------------------");

printf("---------------------------------------------");

printf("\n\n Approximate Solution: ");

printf(" (%8.4f,%8.4f)\n",x1pt,x2pt);

Fvalue:=evalf(subs(x1=x1pt,x2=x2pt,f));

printf(" Maximum Functional Value: ");

printf("%21.4f",Fvalue);

printf("\n Number gradient evaluations:");

printf("%22d",numgeval);

printf("\n Number function evaluations:");

printf("%22d",numfeval);

printf("\n\n-----------------------------------------");

printf("---------------------------------------------");

end:

If q := [q1(t),q2(t),q3(t)];

and L=cos(q1(t))+sin(q2(t))+5*dq1 + 4*dq3

now I want to get the result of the following expression

d(dL/d dq1)/dt=?,

how can i write the expression?

In above expression dq1 is the derivative of q1(t), and dq3 is that of q3(t),

How do I solve (1/2)*n^2 +2n-1=O(n^2) in maple2018?Thank you

curry(`?[]`,f)([1]);
                                                  

I have plotted a 3d figure with MAPLE. How can I snap a point in 3d figure and  show  the coordinate value of snaped point ?It  can be  carried out  easily in MATLAB,but I  cann‘t  snap the point used  point probe tool in MAPLE ?

Given 2 inputs
m = integer
c = integer

where c ≤ m/2

and variables, a_i, b_i, a, b (all non-negative integers)
Here, m is the digit length of a number where a_i and b_i represent digits in a number writen in base b. a is simply b-1 and is used as another digit.

I am interested in generating specific permutations of a_1 ... a_c  a ... a  b_c ... b_1 where the total number of digits is m and the number of a's in the centre is m-2c.

The permutations I am interested in satisfy the condition. a_i is to the left of b_j for i ≤ j


examples for m=7:
c=1
a1,a,a,a,a,a,b1

c=2
a1,a2,a,a,a,b2,b1
a1,a2,a,a,a,b1,b2
a1,b1,a,a,a,a2,b2
a2,a1,a,a,a,b1,b2
a2,a1,a,a,a,b2,b1

c=3
a1,a2,a3,a,b3,b2,b1
...

c=4
n/a   2c > m

I would like a function L(m,c) that creates all valid permuatations of a_1 .. a_c b_1 .. b_c  (2n terms)


I met up with a lecturer at my university and we came up with this code. Unfortunately it is for mathematica as he doesn't use Maple. I feel there may be a more efficient way than to generate all permutations and then delete some.

thank you in advance for any help.

Ben

Hi,

with the Physics package, I want to represent a discrete two-dimensional Hilbert space in a direct-product basis.

I have looked at https://www.mapleprimes.com/posts/209099-Tensor-Product-Of-Quantum-State-Spaces but am not sure how to implement bracketrules.

Let's assume I have one-dimensional bases A and B that span a two-dimensional space C. A is of size Na and B is of size Nb. Consequently, C is of size Na * Nb.

If I understand it correclty, this can be done with

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C})

First question: Is this correct and if yes, why do I need to specify quantumbasisdimension for C?

Then, I want to define, using bracketrules, <A[i]| <B[j]| |Psi> = X[i,j],

where |Psi> lives in the full, two-dimensional space C and X is a matrix.

<B[j]|Psi> would be a state living in A and <A[i]||Psi> would be a state in B.

How do I define this?

bracketrules = {%Bracket(Bra(A, i)*Bra(B, j), Ket(C, t)) = X[i,j](t)}

gives me an error.

I found a way using the nested expression

bracketrules = {%Bracket(Bra(A, i), Ket(A, j)) = X[i,j], %Bracket(Bra(B, j), Ket(C)) = Ket(A, j)}

giving

Bracket(Bra(A, i), Bracket(Bra(B, j), Ket(C, t))) = X[i,j]

but this is error prone, clumsy and only works in one direction:

Bracket(Bra(B, j), Bracket(Bra(A, i), Ket(C)))

does not work. Of course, I could also specify rules for the reverse direction but this is quite an effort for higher-dimensional spaces (I have, e.g., 9-dimensional spaces in mind).

So how do I do this properly?

Please have a look at the attached example, where I also included time-dependence.

Thanks,

Henrik

 


 

-------``

First try

-------

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i)*Bra(B, j), Ket(C, t)) = X[i, j](t)})

Error, (in Physics:-Setup) expected first argument in the Bracket defining a bracket rule to be a 'Bra'; received: Physics:-`*`(%Bra(A, i), %Bra(B, j))

 

 

---------

Second try

---------

 

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Bra(B, j), Ket(C, t)) = X[i, j](t)})

[bracketrules = {%Bracket(%Bra(A, i), %Bra(B, j), %Ket(C, t)) = X[i, j](t)}, disjointedspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}]

(1)

Bracket(Bra(A, i), Bra(B, j), Ket(C, t))

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), Physics:-Ket(C, t))

(2)

--------

Third try

--------

 

 

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Ket(A, j, t)) = X[i, j](t), %Bracket(Bra(B, j), Ket(C, t)) = Ket(A, j, t)})

[bracketrules = {%Bracket(%Bra(A, i), %Ket(A, j, t)) = X[i, j](t), %Bracket(%Bra(B, j), %Ket(C, t)) = Physics:-Ket(A, j, t)}, disjointedspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}]

(3)

Bracket(Bra(A, i).Bra(B, j), Ket(C, t))

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), Physics:-Ket(C, t))

(4)

Bracket(Bra(A, i), Bracket(Bra(B, j), Ket(C, t)))

X[i, j](t)

(5)

Bracket(Bra(B, j), Bracket(Bra(A, i), Ket(C, t)))

Error, (in Physics:-Bracket) expected a Bra and a Ket as a first and last arguments, or no Bra and no Ket when using the shortcut notation; received: Physics:-Bra(B,j), Physics:-Bracket(Physics:-Bra(A,i),Physics:-Ket(C,t))

 

``


 

Download twoD.mw

 

I have 3 lists of equal length:

A:=[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5]
B:=[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5]
C:=[5,2,7,9,1,6,2,8,4,6,2,1,5,8,3,5,2,9,6,6,3,2,1,6,4]

I would like to make a 3-D plot of C dependent on A and B (Ex. C(1,1)=5, C(1,2)=2.. C(5,5)=4).

 

What would be the best way to plot this? I have tried 'pointplot3d' which returns a decent result, but I would prefer a filled plot if possible.

hi

I want to mix two curve and have only one figure(I want to compare two curve in one plot domain )?

Thank you

plot.mw
 

h1 := solve(Vdc = 0.1500000000e-2*sqrt(2.53669508*10^8*u^3-6.06101011*10^8*u^2+3.46343435*10^8*u), u); plot([h1], Vdc = 0 .. 11.5, color = [magenta], thickness = 1); plot(Vector([0, 3.38, 5.21, 6.97, 8.4108, 10.099, 10.9232, 11.8091]), Vector([0, 0.760e-1, .1275, .1994, .2286, .3222, .3637, .999]), style = point, symbol = asterisk, color = "Blue")

 

 

``


 

Download plot.mw

 

 

First 745 746 747 748 749 750 751 Last Page 747 of 2219