MaplePrimes Questions

 

Hello, I would like to make my polynomial equation simpler by replacing every coefficient of each degree in s by any constant.

For example, one of the variable solutions it is:


How can i re-write this equation in the form, lets say, C0+C1*s+C2*s^2+C3*s^3?

I draw a 3d graph and now i want the table of this graph. how can we get a table from the data of a plotted graph.

May grapg was obtained from the following commands

 

restart;
plot3d(1/2*(q^(2*n)-5.*q^n+(2.*q-1)^n+3), q = 2 .. 15, n = 2 .. 20);
 

How can one the last value of variable

when I have variables Like C1;C2,C3....., F1,F2,F32,....so on

always number would be at last of the variable.

Depending upon the number in the variable I need to call values from other list. It would be really helpful to know how one can get the number present in variable?

Hi, I am working on an assignment and have some doubts about my solution to plotting the position of an anharmonic oscilliator with the Runge-Kutta method.

My attempt on the problem:

Handin_2.mw

A picture of the problem is attached below. In addition to this, we are to repeat the problem with k = 0.1 (f = 0 still), and k = 0.1 and f = 0.5. 

 

For example the elemetary charge e constant has the derive descriptor.  Having the descriptor in it, I might have thought there is a builtin way to pull out the derive equation there isn't so one has to do it this way

with(ScientificConstants):
rhs(GetConstant(e)[3])
                                    

However you wouldn't know the 3rd indexed position in the constant was the derive descriptor - it could be in a different location for another constant.

Also, what I wonder is, where is the derive for the Fine Structure Constant

I am carrying out a research in dynamical system to which end I need to do optimal control. I have coded the control equations but its not displaying any result. I need guidance. The code is shown below....

 

restart;
with(plots);
r := 3; r[1] := 3; k := 10; a := 0.2e-1; b := 0.1e-1; c := 0.1e-1; beta := 0.3e-1; alpha := 0.3e-1; m := 0.5e-1;
z := 40; q := 5; p := 100; T := 3;
sigma := 0.1e-1; k[1] := 10; rho := 0.5e-1;

u[1] := min(max(0, z), 1); z := (a*m*k*lambda[2](t)*x(t)*y(t)-lambda[1](t)*r*(1+b*x(t)+c*y(t))*x(t)*x(t))/(z*k*(1+b*x(t)+c*y(t))); u[2] := min(max(0, q), 1); q := -lambda[1](t)*beta*x(t)*s(t)/q; u[3] := min(max(0, p), 1); p := -(r[1]*lambda[3](t)*s(t)*s(t))/(p*k[1]);
NULL;
sys := diff(x(t), t) = r*x(t)*(1-(1-u[1])*x(t)/k)-a*m*x(t)*y(t)/(1+b*x(t)+c*y(t))-beta*(1-u[2])*x(t)*s(t), diff(y(t), t) = -alpha*y(t)+a*m*x(t)*y(t)/(1+b*x(t)+c*y(t)), diff(s(t), t) = sigma*s(t)+r[1]*s(t)*(1-(1-u[3])*s(t)/k[1])-rho*s(t)*y(t), diff(lambda[1](t), t) = -lambda[1](t)*(r-2*r*(1-u[1])*x(t)/k-a*y(t)*(1+c*y(t))/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t)))-beta*(1-u[2])*s(t))-lambda[2](t)*a*m*(1-u[1])*(1+c*y(t))*y(t)/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t))), diff(lambda[2](t), t) = -lambda[1](t)*a*x(t)*(1+b*x(t))/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t)))+lambda[2](t) . (-alpha+(a*m*(1-u[1]) . (1+b*x(t)))*x(t)/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t))))+lambda[3](t)*rho*s(t), diff(lambda[3](t), t) = lambda[1](t)*beta*(1-u[2])*x(t)-lambda[1](t)*(r[1]-2*r[1]*(1-u[3])*s(t)/k[1]-sigma-rho*y(t)), x(0) = 100, y(0) = 200, s(0) = 100, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0;
p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = .1);
 

Hi!

I have the following problem: to create a special elimination ordering which is a weighted degree ordering suitable for elimination + pure lexicographic ordering. Let me provide an example. Assume my variables are x,y,z,t,u,v and I want to eliminate x,y,z. For this purpose, I define the weight vector [1,1,1,0,0,0] and compare monomials wrt corresponding weighted degree. If such degrees are equal, I compare monomials by pure lexicographic ordering. This is exactly what I need. How to obtain such monomial ordering by the package Groebner? I have tried monomial orderings defined by matrices using command  'matrix'(M,vars) but it seems it does not work for 30 variables.

Any suggestion? Thanks in advance.

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),

First 757 758 759 760 761 762 763 Last Page 759 of 2429