Opened 11 years ago

Last modified 11 years ago

#12237 closed defect

erf of complex arguments — at Version 1

Reported by: Volker Braun Owned by: jason, jkantor
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: numerical Keywords:
Cc: Merged in:
Authors: Volker Braun Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Volker Braun)

The erf function doesn't work for complex arguments, even though we use Pari and Pari does support it. This is also annoying because maxima sometimes returns erf(complex argument) in integrations:

sage: integrate(sin(x)*(x^(1/2)),x,0,1)
-1/8*((I + 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)) + (I - 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)))*sqrt(pi) - cos(1)
sage: _.n()
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1111, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/vbraun/opt/sage-weak/sage-4.8.alpha5/<ipython console> in <module>()

/home/vbraun/opt/sage-4.8.alpha4/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._numerical_approx (sage/symbolic/expression.cpp:18004)()

/home/vbraun/opt/sage-4.8.alpha4/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._convert (sage/symbolic/expression.cpp:5089)()

/home/vbraun/opt/sage-4.8.alpha4/local/lib/python2.6/site-packages/sage/functions/other.pyc in _evalf_(self, x, parent)
     79         if prec > 53:
     80             raise NotImplementedError, "erf not implemented for precision higher than 53"
---> 81         return parent(1 - pari(float(x)).erfc())
     82         
     83     def _derivative_(self, x, diff_param=None):

/home/vbraun/opt/sage-4.8.alpha4/local/lib/python2.6/site-packages/sage/rings/complex_number.so in sage.rings.complex_number.ComplexNumber.__float__ (sage/rings/complex_number.c:7501)()

TypeError: Unable to convert -0.707106781186547 + 0.707106781186547*I to float; use abs() or real_part() as desired

Apply trac_12237_complex_erfc.patch

Change History (2)

Changed 11 years ago by Volker Braun

Initial patch

comment:1 Changed 11 years ago by Volker Braun

Description: modified (diff)
Status: newneeds_review
Note: See TracTickets for help on using tickets.