Doug Bradshaw wrote:
> Okay, here's the story:  I wanted to plot a Fourier transform of a
> Gaussian that is truncated (mulitplied by unit step function).  Using
> "integral", I got an answer that looked nice, but contained an error
> function with an imaginary argument.  Because that error function
> couldn't be evaluated, I couldn't plot.  So, that brings up the
> question: is there a nice way to evaluate the error function of an
> imaginary number (or more generally a complex number) in Sage?
> 
> sage: erf(1)
> erf(1)
> sage: erf(1).n()
> 0.842700792949715
> sage: erf(I)
> erf(I)
> sage: erf(I).n()
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>

I'm not sure about the Sage erf, but you could also use the scipy erf:

sage: import scipy.special
sage: scipy.special.erf(complex(I))
1.6504257587975433j

You could also do scipy.special.<tab> (press tab) to see the other 
variants of erf that scipy has.

Note that you need to do complex(I) or the equivalent, since scipy does 
not understand Sage complex numbers.

See 
http://docs.scipy.org/doc/scipy/reference/special.html#error-function-and-fresnel-integrals

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to