2010-10-14 06:01, Oscar Gerardo Lazo Arjona skrev:
I've been trying to solve this integral:

sage: numerical_integral(sqrt(sec(x)-1),pi/2,pi)
(nan, nan)

But that failed also... So I tried with mathematica:

numerical integration should be fairly easy to extend to complex
numbers. Am I missing something?

A workaround seems to be to integrate the real and imaginary parts separately:

sage: numerical_integral(real(sqrt(sec(x)-1)),pi/2, pi)
(1.9175999157365625e-16, 5.0010185963949996e-17)
sage: numerical_integral(imag(sqrt(sec(x)-1)),pi/2, pi)
(3.1415926269162875, 2.3498999460392589e-06)

... giving the same result as Mathematica (although numerically).

It seems to me that the integration is performed by gsl, and the gsl integration routine seems only to take real-valued functions as arguments, but I have not looked at this previously, so I may be missing something as well.

Regards

Johan

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to