Question: calling latex makes pdsolve fail

This below shows strange side effect of calling latex(sol,'output'='string'):

calling pdsolve on one pde, followed by latex() call, cause the next call after that to pdsolve to fail.

Any idea why this happens and any workaround so code can call latex in between without getting this error?

i.e.   sol:=pdsolve(...);  sol:=pdsolve(...);  WORKS

But    sol:=pdsolve(...); latex(sol,output=string);   sol:=pdsolve(...);  FAIL

Clearly there is some global/buffering issue somewhere. Why is calling latex makes pdsolve fail?

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1871 and is the same as the version installed in this computer, created 2025, May 15, 11:28 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 17 and is the same as the version installed in this computer, created May 5, 2025, 12:37 hours Eastern Time.`

restart;

pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+(exp(-c*t)*sin(2*Pi*x/L));
ic  :=  u(x,0)=f(x);
bc  :=  D[1](u)(0,t)=0, D[1](u)(L,t)=0;
sol:=pdsolve([pde,ic,bc],u(x,t)) assuming L>0,t>0,k>0:

diff(u(x, t), t) = k*(diff(diff(u(x, t), x), x))+exp(-c*t)*sin(2*Pi*x/L)

u(x, 0) = f(x)

(D[1](u))(0, t) = 0, (D[1](u))(L, t) = 0

the_latex:=latex(sol,'output'='string'): #THIS CAUSE ERROR in next command, if this was not here, next call works

pde := diff(u(x,t),t)=k*diff(u(x,t),x$2)-beta*u(x,t);
bc:= D[1](u)(0,t)=0,D[1](u)(Pi,t)=0;
ic  := u(x,0)=x;
sol:=pdsolve([pde,bc,ic],u(x,t)) assuming beta>0;

diff(u(x, t), t) = k*(diff(diff(u(x, t), x), x))-beta*u(x, t)

(D[1](u))(0, t) = 0, (D[1](u))(Pi, t) = 0

u(x, 0) = x

Error, (in assuming) when calling 'unknown'. Received: 'invalid input: diff received Pi, which is not valid for its 2nd argument'

 


 

Download strange_latex_effect.mw

 

Please Wait...