Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Simplify exponentials

I'm using Sage to check the initial condition for a solution to the advection-diffusion equation. Here the initial condition is checked using a limit whose result should be zero. But, Sage gives the difference of two equivalent exponentials and leaves it without simplifying to zero. These exponentials only differ in that one has a 1/10 in it and one has a 0.1.

Here is the code:

var('u,x,t')
erfc(x) = 1-erf(x)
k=0.03
D=0.3
C=2.
u(x,t) = C*1/2*(erfc((x-k*t)/sqrt(4*D*t))+exp(x*k/D)*erfc((x+k*t)/sqrt(4*D*t)))
assume(x>0)
ans=limit(u(x,t),t=0,dir='+')
print ans.simplify_full()

The result is:

-e^(1/10*x) + e^(0.1*x)

Any advice on how to get this to simplify to zero?