Question: is assume(...); do_something(); the same as do_something() assuming(...); ?

Why is assume(...) do_something();  gives an error when I run the code one more time, but do_something() assuming ...; do not give an error when everything else is the same?

Is there semantic difference between the two forms? I thought they should work the same way. Here is an example

#in separate cell
restart;

#in separate cell
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
assume(x>0);assume(t>0);assume(k>0):
sol:= pdsolve({pde,ic,bc},u(x,t)):

#in separate cell. Now this gives error
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
assume(x>0);assume(t>0);assume(k>0):
sol:= pdsolve({pde,ic,bc},u(x,t)):
#error message now

Here is screen shot

Now will do the same, but use assuming. Now there is no error

#in one cell
restart;

#in one cell
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
sol:= pdsolve({pde,ic,bc},u(x,t)) assuming x>0,t>0,k>0:

#in one cell, no error
interface(showassumed=0):
pde := diff(u(x, t), t)=k*diff(u(x, t), x$2):
ic:=u(x,0)=0: bc:=u(0,t)=t:
sol:= pdsolve({pde,ic,bc},u(x,t)) assuming x>0,t>0,k>0:

Here is screen shot

Why does one give an error, but the second one does not?

I thought they work the same way. Which method is recommended to use?

assume(...); do_something(); 

or 

do_something() assuming ...;

Maple 2018 on windows.

Please Wait...