Question: Slow and not accurate

  restart: with(plots):
  H := a -> piecewise(a>=0,1):
  f1 := y->(H(y-1*Pi)-H(y-2*Pi))*sin(y)^2:

  g1:=(f1(y)/sqrt(4*Pi*t))*(sin((x-y)^2/4/t+Pi/4)-sin((x+y)^2/4/t+Pi/4)):
  g2:= int(g1, y= 0..100):

  g3:= diff(g2,t):
  g4:= diff(g2,x$2):
  g5:= (g3^2+g4^2)/2:
  E2:= unapply(Int(g5, x= 0..100, epsilon= 1e-4, digits= 7), t):
  CodeTools:-Usage( plot(E2, 0..20, numpoints= 50, labels= [t, E]));

The above mentioned code should give constant figure, but it takes a lot of time and not accurate.

If you can help me to improve these codes, I would be pleased.

 

Thanks!

Please Wait...