No, it doesn't make sense because, in general, separating the real
and the imaginary parts, symbolically
--
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 thi
oops...
if what you are doing is separating the real and imaginary parts
symbolically,
then it will not always work at the boundaries of numerical
evaluation.
Consider that you may think that expression xyz is non-negative and
thus
sqrt(xyz) is real. But numerical evaluation makes xyz very ver
On 9 November 2010 08:25, David Kirkby wrote:
> 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,
On 14 October 2010 22:40, Oscar Lazo wrote:
>
>
> On Oct 14, 4:54 am, Johan Grönqvist 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)
>> sa
+1, I've had to do that manually myself before.
On Oct 14, 2010 2:40 PM, "Oscar Lazo" wrote:
On Oct 14, 4:54 am, Johan Grönqvist wrote:
> A workaround seems to be ...
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
On Oct 14, 4:54 am, Johan Grönqvist 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)
>
So it happened again... I had such a discussion some time ago in one
other thread are are several other problems with numerical integration
which occour.
The thing is, that sage holds a lot of tool to perform numerical
integration to get a good answer (pari, mpmath, scipy etc.) but
sometimes it wo
Here's one way to do it using mpmath; there might be better ways:
sage: from mpmath import *
sage: mp.dps = 15; mp.pretty = True
sage: f = lambda x: sqrt(sec(x)-1)
sage: quad(f, [pi/2, pi])
(1.43051518370573e-8 + 3.14159264808335j)
To get back to a sage type you could do:
sage: ans=quad(f, [pi/2
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 so