> Using SageMathCloud I was surprised to find this bug:
>
> integral(sqrt(cos(x)-cos(x)^3), x, 0, pi/2)
> -2/3
>
> The correct result is 2/3 (luckily I noticed that something was wrong 
> because the result must be positive!)
>
> numerical_integral gets it right:
>
> numerical_integral(sqrt(cos(x)-cos(x)^3), 0, pi/2)
> (0.6666666687973078, 4.409680787972339e-07)
>
>
Usually such things are due to abs_integrate (see e.g. 
http://trac.sagemath.org/ticket/12731 and 
http://trac.sagemath.org/wiki/symbolics), but interestingly, abs_integrate 
comes to the *rescue* when domain:real.  The problem here is due to 
domain:complex (which is our default).

sage -maxima
...
(%i1) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi/2);
(%o1)                                  0
(%i3) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi);  
                                       2
(%o3)                                  -
                                       3
(%i4) load(abs_integrate);
(%o4) 
/Users/karl.crisman/Downloads/sage/local/share/maxima/5.35.1/share/contr\
ib/integration/abs_integrate.mac
(%i5) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi/2);
                                       2
(%o5)                                  -
                                       3
(%i6) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi);  
(%o6)                                  0
(%i7) domain:complex; 
(%o7)                               complex
(%i8) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi/2);
                                        2
(%o8)                                 - -
                                        3
(%i9) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi); 
                                   2 %i   2
(%o9)                              ---- - -
                                    3     3

new session:

(%i1) domain:complex;
(%o1)                               complex
(%i2) integrate(sqrt(cos(x)-cos(x)^3),x,0,%pi/2);
                                        2
(%o2)                                 - -
                                        3

Nils or Ralf or others, any thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to