Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I'm trying to do something very simple, but I can not do it. I would like to fill the chart with colors of my choice.

restart: with (plots):
plots [animate] (plot, [[sqrt (x), sqrt (x) -1], x = 0..t, filled = true, view = [0..20, 0..5]], t = 0..20);

The filled = true option fills the graph with random colors.
I tried to use filled = ["Blue", "Red"], but that does not work.

Any tips?

Thank you

 

I got this solution from a PDE. I normally use unapply on the RHS of the solution to make it a function.

But in this, the PDE solution contain some extra stuff at the end. Which  "Where { .....}"

So the only way for me, was to manually copy the initial part of the solution shown on the screen in order to use it later.

I could not find a way to program this part.

Here is an example

restart;

f:=(r,z)->(r-a)*sin(z/H*Pi);
lap:=VectorCalculus:-Laplacian(u(r, z, t), cylindrical[r, theta,z]);
bc:=u(r,0,t)=0,u(r,H,t)=0, u(a,z,t)=0;
ic:=u(r,z,0) = f(r,z);
sol:=pdsolve([diff(u(r,z,t),t) = k*lap,bc,ic],u(r,z,t)) assuming a>0,k>0;

THis gives

Which I verified to be correct.

In case you are not able to get this solution (it needs Maple 2019.1 and Physics 368), here is the lprint

 

lprint(sol)

u(r,z,t) = `casesplit/ans`(Sum(-BesselJ(0,lambda[n]/a*r)*sin(z/H*Pi)*exp(-k*t*(
H^2*lambda[n]^2+Pi^2*a^2)/a^2/H^2)*a/lambda[n]^2*Pi*BesselJ(1,lambda[n])*
StruveH(0,lambda[n])/hypergeom([1/2],[1, 2],-lambda[n]^2),n = 1 .. infinity),{
And(lambda[n] = BesselJZeros(0,n),0 < lambda[n])})

Next to use it (plot., evaluate, etc...) changed the sum go to 15 terms (more than enough) and also replaced a->1,H->3,k->1/100 and  also replaced lambda[n] with BesselJ zeros as follows

sol:=subs({infinity=15,a=1,H=3,k=1/100,lambda[n]=BesselJZeros(0, n)},sol);

Before I use unapply, I had to extract the part of the solution up to where it says "where..." since I do not need the rest any more, since I allready replaced lambda[n] with BesselJZeros calls.

This I did by hand using copy/paste from the screen. Now I am able to finish the task:

solFiltered:=Sum(-BesselJ(0, BesselJZeros(0, n)*r)*sin(z*Pi/3)*
     exp(-t*(9*BesselJZeros(0, n)^2 + Pi^2)/900)*Pi*
     BesselJ(1, BesselJZeros(0, n))*
     StruveH(0, BesselJZeros(0, n))/(BesselJZeros(0, n)^2*
     hypergeom([1/2], [1, 2], -BesselJZeros(0, n)^2)), n = 1 .. 15):

mapleSol:=unapply(solFiltered,r,z,t);

value(mapleSol(.5,2,1));

Which prints -0.4107565091 which is the correct value. It matches my hand solution and also match numerical solution.

What would a better way to do the above than what I did? i.e. to obtain the solFitered above using code only? 

Consider a wave y=f(x,t) with amplitude modulation such that it becomes

 y_new=(1+A)*f(x,t), where A=A(t) is a small perturbation.

How can I do the simulation to test the robustness of the system to see if the wave is stable / unstable under perturbation? As the time t goes to infinity, I want to see if the original wave is distorted or not under either random or prescribed perturbation.

P.S. For example,  f(x,t) = (sech(0.5*x-0.1*t))^2.

Thank you for your help.

Hi,

Can someone please help me plot a bunch of tangent lines to approximate the given space curve? I know how to do it in another CAS system however I am trying to make the switch over to maple.  Question.mw.  

 

 

Thanks

William

Hi everyone.I need to solve this equation and find x:

(1+a×cos(theta1×x))×cos(theta2×x)=b;

theta2 is bigger than theta1.a and b are constant number.I need to know how solve it?

I installed Physics package 368 and when I run a test, I found that now the latex() command fails with internal  error which I have never seen before. I think this is first time I see latex() gives an error.

restart

lap:=VectorCalculus:-Laplacian(u(r,z,t),'cylindrical'[r,theta,z]):
bc:=u(r,0,t)=0,u(r,H,t)=0, u(a,z,t)=0:
ic:=u(r,z,0) = f(r,z):
sol:=pdsolve([diff(u(r,z,t),t) = k*lap,bc,ic],u(r,z,t)) assuming a>0,r<a,H>0,k>0;
latex(sol);

u(r, z, t) = `casesplit/ans`(Sum(Sum(4*BesselJ(0, lambda[n1]*r/a)*sin(n*Pi*z/H)*exp(-k*t*(Pi^2*a^2*n^2+H^2*lambda[n1]^2)/(a^2*H^2))*(Int(BesselJ(0, lambda[n1]*r/a)*r*(Int(sin(n*Pi*z/H)*f(r, z), z = 0 .. H, AllSolutions)), r = 0 .. a, AllSolutions))/(H*a^2*hypergeom([1/2], [1, 2], -lambda[n1]^2)), n = 1 .. infinity), n1 = 1 .. infinity), {And(lambda[n1] = BesselJZeros(0, n1), 0 <= lambda[n1])})

Error, (in latex/int) invalid arguments

lprint(sol)

u(r,z,t) = `casesplit/ans`(Sum(Sum(4*BesselJ(0,lambda[n1]/a*r)*sin(n/H*Pi*z)*
exp(-k*t*(Pi^2*a^2*n^2+H^2*lambda[n1]^2)/a^2/H^2)*Int(BesselJ(0,lambda[n1]/a*r)
*r*Int(sin(n/H*Pi*z)*f(r,z),z = 0 .. H,AllSolutions),r = 0 .. a,AllSolutions)/H
/a^2/hypergeom([1/2],[1, 2],-lambda[n1]^2),n = 1 .. infinity),n1 = 1 ..
infinity),{And(lambda[n1] = BesselJZeros(0,n1),0 <= lambda[n1])})

 


 

Download bug_june_6_2019.mw

Is this a new bug? Why latex() command now fails? It failed on the above output. When I try latex() on simpler output. no error is generated. So something to do with the above specific output seems to be the issue.

Maple 2019.1 using Physics 368 on windows 10.

 

    

please where is the problem 

with(DEtools);

eq1 := (D(x))(t) = -y(t);

eq2 := (D(y))(t) = x(t)+2*x(t)^3-signum(z(t));

eq3 := (D(z))(t) = w(t);

eq4 := (D(w))(t) = -z(t)*(1+6*x(t)^2);

sys := eq1, eq2, eq3, eq4;

ic1 := [x(0) = 0, y(0) = 0, z(0) = cos(1), w(0) = sin(1)];

ic2 := [x(0) = 0, y(0) = 0, z(0) = cos(2.5), w(0) = sin(2.5)];

ic := ic1, ic2;

DEplot([sys], [x(t), y(t), z(t), w(t)], t = 0 .. 10, [ic], stepsize = 0.5e-1, scene = [x(t), y(t)], linecolor = [blue, red]);

sol1:=dsolve({sys,x(0)=0,y(0)=0,z(0)=cos(1),w(0)=sin(1)},{x(t),y(t),z(t),w(t)},type=numeric);

T := 10.0 ; N := 100 ; h := T/N;

xk := 0;

for k from 1 to N do

 solk := sol1(k*h);

  xknew := subs(solk,x(t));

 yknew := subs(solk,y(t));

 if xk*xknew<=0 and abs(yknew-6)<0.5 then break fi;

 xk := xknew;

od; sol1(k*h);

temps := proc(alpha,eps)

local sol,solk,T,N,h,k,xk,xknew,yknew,t0,t1,tm,x0,x1,xm;

sol := dsolve({sys,x(0)=0,y(0)=0,z(0)=cos(alpha),w(0)=sin(alpha)},{x(t),y(t),z(t),w(t)},type=numeric);

T := 10.0 ; N := 100 ; h := T/N;

xk := 0;

for k from 1 to N do

 solk := sol(k*h);

  xknew := subs(solk,x(t));

 yknew := subs(solk,y(t));

 if xk*xknew<=0 and abs(yknew-6)<0.5 then break fi;

 xk := xknew;

od; 

t0 := (k-1)*h ; t1 := k*h ;

x0 := subs(sol(t0),x(t)) ; x1 := subs(sol(t1),x(t)) ;

while abs(x0-x1)>eps do

 tm := (t0+t1)/2;

 xm := subs(sol(tm),x(t));

 if xm*x0<0 then x1 := xm; t1:=tm;

            else x0 := xm; t0:=tm;

 fi;

od;

RETURN(t0);

end;

 

dicho := proc(eps)

local a,b,m,sola,solb,solm,ta,tb,tm,ya,yb,ym;

a := 1 ; b := 2.5 ;

sola := dsolve({sys,x(0)=0,y(0)=0,z(0)=cos(a),w(0)=sin(a)},{x(t),y(t),z(t),w(t)},type=numeric);

solb := dsolve({sys,x(0)=0,y(0)=0,z(0)=cos(b),w(0)=sin(b)},{x(t),y(t),z(t),w(t)},type=numeric);

ta := temps(a,eps) ; tb := temps(b,eps) ;

ya := subs(sola(ta),y(t)) ; yb := subs(solb(tb),y(t)) ;

while abs(yb-ya)>eps do

m := evalf((a+b)/2);

solm := dsolve({sys,x(0)=0,y(0)=0,z(0)=cos(m),w(0)=sin(m)},{x(t),y(t),z(t),w(t)},type=numeric);

tm := temps(m,eps) ;

yb := subs(sol(tm),y(t));

 if (ym-6)*(ya-6)<0 then b := m; yb := ym;

            else a := m; ya := ym;

 fi;

od;

RETURN(a);

end;

dicho(0.01);

2.136718750

temps(2.136718750,0.01);

8.737500000

DEplot([sys], [x(t), y(t), z(t), w(t)], t = 0 .. 8.7375, [[x(0)=0,y(0)=0,z(0)=cos(2.136718750),w(0)=sin(2.136718750)]], stepsize = 0.5e-1, scene = [x(t), y(t)], linecolor = [blue]);

 

 

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

Hi,

I am trying to write a code for the following simple recurrence:

a(1)=1,

a(n)+1prime—>a(n+1)=a(n)+1,

a(n)+1 composite —>a(n+1)=n+2

if a(n) even, or a(n)+ 3 if a(n) odd.

Data: 1,2,3,6,7,10,11,14,16,17.....

My first attempt is the following:

N:=10:

for k from 1 to N do

X:=1;

if isprime(X+1) then print(X+1);

elif not isprime(X+1) and mod(X,2)=0 

then print(X+2);

else print(X+3);

end if:

end do:

This does not work but I cannot see why. Would somebody mind to help me out with this?

 

Best regards

David.

 

 

 

I have the following equation:

.9215999996*z^4+.9999999996*z^4*s^4-2.079999999*z^4*s^2-3.212799999*s*z^3+12.63999999*s^3*z^3-7.999999997*s^5*z^3-24.17694443*s^4*z^2-.3071555554*s^2*z^2+23.99999999*s^6*z^2-31.99999999*s^7*z+6.804911108*s^3*z+11.58777777*s^5*z+15.99999999*s^8+5.692222220*s^6-4.853219442*s^4=0

where s is real and z is complex.

 

How do I plot the graph Im(z) versus s?

 

Thank you very much for your help!

I have the following two equations:

u=1-(8*(10.3968*t^2-5.8368*t*f-.229376*f^2-5.1984))/(4.56*t^2-2.56*t*f+.8192*f^2+2.28)^2;

x = f+t-(8*(-2.28*t+.64*f))/(2.28+2*(-t+.64*f)^2+2.56*t^2);

 

How can I plot

(i) a 2-dimensional graph that u versus x at t=0?

(ii) a 3-dimensional graph that u versus x and t ?

 

Thank you a lot for your help!

 

This is a new error I have not seen before.  

Trying to verify my solution for the diffusion pde in cylinderical coordinates wth no angle theta dependency.

unassign('z,t,r,u');
lap:=diff(u(r,z,t),r$2)+ 1/r*diff(u(r,z,t),r)+diff(u(r,z,t),z$2);
bc:=u(r,0,t)=0,u(r,1,t)=0, u(1,z,t)=0;
ic:=u(r,z,0) = f(r,z);
pdsolve([diff(u(r,z,t),t) = lap,bc,ic],u(r,z,t)) assuming t>0

The error is

 

Error, (in assuming) when calling 'BesselJZeros'. Received: '0th zero of BesselJ(0,x) not defined'

Is this a bug or Am I doing something wrong? 

update

fyi, it also fails with same error when trying boundedseries HINT

restart;
unassign('z,t,r,u');
lap:=VectorCalculus:-Laplacian(u(r, z, t), cylindrical[r, theta,z]);
bc:=u(r,0,t)=0,u(r,1,t)=0, u(1,z,t)=0;
ic:=u(r,z,0) = f(r,z);
pdsolve([diff(u(r,z,t),t) = lap,bc,ic],u(r,z,t),HINT=boundedseries(r=0))

I am using Maple 2019.1 with Physics 366 on windows 10

 

odeplot plots "paths", i. e. keeps the points at every time.

I want to see only the "current" position where the particle is in the frame. I want the animation to show the particle in movement, not the path it is drawing.

Thanks in advance.

Hello,

I converted the results in maple to latex format. I copy them in math type software an error is appeared which shows the volume of latex file is very big to transfer.

If I want to use other software to input latex input and then I copy the equation in  office, please guide me how I can write the results obtained  in maple and transfer in word by other softwares?

Thanks

I want to convert the following expression to form of ‘a+bi’,unfortunately,it can't be successful,Can anyone help me?

 

2*omega^2*B[1]*Zeta*omega[0] - omega^3*B[1]*I + omega*B[1]*omega[0]^2*I - 2*I*B[0]*Zeta*omega*omega[0] - B[0]*omega^2 + B[0]*omega[0]^2

f1:=proc(n) local x,y,i,rx ,ry,dumbindex:  

dumbindex:=1:  

xdumb[1]:=n:  

ydumb[1]:=n:  

for i from 1 to  n do    

d:=0.00197241:  flag:=1:  

while(d>0.0019724 or flag=1) do    

rx:=rand(1..n):  x[i]:=rx():  ry:=rand(x[i]..n):  y[i]:=ry():  flag:=check(x[i],y[i],xdumb,ydumb,dumbindex):  

if flag=1 then  dumbindex:=dumbindex+1  xdumb[dumbindex]:=x[i]:  ydumb[dumbindex]:=y[i]:  fi:  

p,d:=f(x[i],y[i]):  

end :  

xl[i]:=x[i]:yl[i]:=y[i]:  

if  i=1 then   temp:=p:xg:=x[i]:yg:=y[i];  

else  

if p<temp then   temp:=p:xg:=x[i]:yg:=y[i] ;  fi:  

fi:

end do:  

return xg,yg:  

end proc;

 

That's the definition of my procedure. It reported illegal use of an object as a name error. Could anyone help have a look and point out what goes wrong. I just started using Maple. Thanks a million in advance.

First 550 551 552 553 554 555 556 Last Page 552 of 2097