On 14 October 2010 22:40, Oscar Lazo <estadisticame...@gmail.com> wrote: > > > On Oct 14, 4:54 am, Johan Grönqvist <johan.gronqv...@gmail.com> wrote: >> 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) > > I think it would be enough to add an option to numerical_integral on > the likes of: > > sage: numerical_integral(sqrt(sec(x)-1),pi/2, pi,complex=True) > > so that it would do the following internally: > > rea=numerical_integral(rea(sqrt(sec(x)-1)),pi/2, pi) > ima=numerical_integral(imag(sqrt(sec(x)-1)),pi/2, pi) > > return ( rea[0]+I*ima[0], rea[1], ima[1]) > > what do you think? I could do this myself very easily if we agree that > this is a good idea. > > Oscar
IMHO, it would be sensible to make that the default method, which is what happens in Mathematica's NIntegrate command. You don't need to specify Nintegrate to return both the real and imaginary parts - it does that automatically. In this case, you can see it gets a small real part too, which you know is just rounding errors. In[1]:= NIntegrate[Sqrt[Sec[x]-1],{x,Pi/2,Pi}] Out[1]= 3.45315 10^-10 + 3.14159 I Dave -- 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