nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

I do not understand why Maple can simplify this expression below when told that n is integer and also positive using a "," to separate the assumptions, but does simpify the same expression when using "and" to build the assumptions.

Here is an example

restart;
result:=int(x*cos(n*Pi/5*x),x=0..5)
simplify(result) assuming n::integer and n>0

But this works

simplify(result) assuming n::integer, n>0

What are the semantic differences between writing assuming "n::integer and n>0" and "n::integer,n>0" ? I thought these would be the same, but clearly they are not.

Maple 2019.1 on windows.

Is there an option or setting to tell Maple not to return trivial solution as a solution to a PDE? Even though trivial solution is correct, it is not something I wanted, and it is making it hard for me to check if the solution is trivial or not. 

Here is an example:

pde:=I*diff(f(x,t),t)=-diff(f(x,t),x$2)+2*x^2*f(x,t):
bc:=f(-infinity ,t)=0,f(infinity,t)=0:
pdsolve([pde,bc],f(x,t))

Mathematica returns this

If there is no such option in Maple, what would be a good way to check for trivial solution using Maple code?

Just checking if rhs(sol)=0 does not work all the time, as some actual solutions are returned with 0 in rhs, like this example

pde := diff(u(x, y), x) + u(x,y)*diff(u(x, y),y) =0:
sol:=pdsolve(pde,u(x,y)):
sol:=DEtools:-remove_RootOf(sol)

So I need either find a way to tell Maple not to return trivial solution, or good robust way to check if solution returned is the trivial solution so I can reject it.

Any suggestion from the Maple experts how to handle this? I am now just interested in result from pdsolve, not dsolve.

The input is the PDE itself, read from a file. So this has to be done without visual inspection on the screen as the program reads the PDE from a file and process it. So the dependent variable and the independent variables are all included in the PDE itself. To make it more clear, I need a function such as

is_solution_trivial :=proc(pde,sol)
     #decide if sol is trivial solution or not.
     #one possibility is to find from the PDE the dependent variable
     #and the independent variables as in u(x,y,t,....) and then check
     #if sol  has the form u(x,y,t,....) =0 ?
end proc;

The above I can use until I figure how to tell Maple NOT to return trivial solution in first place!

 

   

Maple 2019.1

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? 

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.

 

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

 

First 141 142 143 144 145 146 147 Last Page 143 of 199