Question: singularity avoidance problem for numerical integration

Hi,

I would like to plot E2(t) , but It gives errors. How can I avoid the singularity and solve this problem?


restart: with(plots):
with(Student[NumericalAnalysis]):
g1:=(x,t)->(-sqrt(t)/(2*sqrt(Pi*r^3)))*(sin((r*(x-1)^(2)/(4*t))+(Pi/4))-sin((r*(x+1)^(2)/(4*t))+(Pi/4))):

g2:=(x,t)->int(g1(x,t),r=1..infinity);

g3:=(x,t) -> (diff(g2(x,t),t)):


g4:=(x,t) -> (diff(g2(x,t),x,x)):


g5:=(x,t) -> ((1/2)*(g3(x,t)^2+g4(x,t)^2)):


E2:=t->(int(g5(x,t),x=0..100)):

evalf(E2(0));
Error, (in g1) numeric exception: division by zero
evalf(E2(1));
Error, (in g3) invalid input: diff received 1, which is not valid for its 2nd argument
plot(E2(t),t=0..20);

Best regards,

 

Please Wait...