Possible bugs in integrate?



I think this is a numerical analysis problem. Try expanding before applying
float:

(%i65) ff:exp(-x^2/50^2)*sin(x)^2*cos(2*x)$
(%i66) gg : integrate(ff,x,-4*%pi,4*%pi)$
(%i67) float(gg);
(%o67) 0.0
(%i68) float(expand(gg));
(%o68) -6.153361529128077

Look at both gg and expand(gg). You should see why (%o67) = 0.0, but
(%o68) isn't 0.0.

Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To: maxima-help <maxima at math.utexas.edu>
>From: Detlef Schmicker <d.schmicker at physik.de>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 06/07/2007 01:31PM
>Subject: Possible bugs in integrate?
>
>Hello,
>
>I was trying to integrate a not to complicate function, but the result
>was very strange.
>
>(%i161) ff:exp(-x^2/3^2)*sin(x)^2*cos(2*x);
>(%o162) %e^(-x^2/9)*sin(x)^2*cos(2*x)
>
>(%i163) quad_qag(ff,x,-4*%pi,4*%pi,6);
>(%o163) [-1.329012281002591,1.8823701278258831*10^-14,183,0]
>
>(%i164) integrate(ff,x,-4*%pi,4*%pi);
>(%o164) -(%e^(-36)*sqrt(%pi)*(3*erf((4*%pi+18*%i)/3)-6*%e^27*erf((4*%pi
>+9*%i)/3)-6*%e^27*erf((4*%pi-9*%i)/3)+3*erf((4*%pi-18*%i)/3)+6*%
>e^36*erf((4*%pi)/3)))/8
>
>(%i165) float(%);
>(%o165) -5.1390589659105944*10^-17*(3.0*erf(0.33333333333333*(18.0*%i
>+12.56637061435917))-3.192289443610792*10^+12*
>erf(0.33333333333333*(9.0*%i+12.56637061435917))-3.192289443610792*10^
>+12*erf(0.33333333333333*(12.56637061435917-9.0*%i))+3.0*
>erf(0.33333333333333*(12.56637061435917-18.0*%i))+2.5867389201337716*10^
>+16)
>
>
>The result of the numerical integration seems correct, but the symbolic
>result is quite strange. Especially if one increases the divident (9) in
>the exponential function integrate results in 0
>
>(%i171) ff:exp(-x^2/50^2)*sin(x)^2*cos(2*x);
>(%o171) %e^(-x^2/2500)*sin(x)^2*cos(2*x)
>(%i172) integrate(ff,x,-4*%pi,4*%pi);
>(%o172) -
>(%e^(-10000)*sqrt(%pi)*(25*erf((2*%pi+2500*%i)/25)-50*%e^7500*erf((2*%pi
>+1250*%i)/25)-50*%e^7500*erf((2*%pi-1250*%i)/25)+25*erf((2*%pi-2500*%
>i)/25)+50*%e^10000*erf((2*%pi)/25)))/4
>(%i173) float(%);
>(%o173) 0.0
>
>
>while the correct result should be close to
>
>(%i169) ff:sin(x)^2*cos(2*x);
>(%o169) sin(x)^2*cos(2*x)
>(%i170) integrate(ff,x,-4*%pi,4*%pi);
>(%o170) -2*%pi
>
>if I did not make a simple mistake.
>
>Any help?
>
>Thanks a lot,
>
>Detlef
>
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima