Opened 11 years ago
Closed 11 years ago
#12237 closed defect (duplicate)
erf of complex arguments
Reported by: | vbraun | Owned by: | jason, jkantor |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | numerical | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | Jeroen Demeyer | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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
See #11948 for a better solution.
Attachments (1)
Change History (4)
Changed 11 years ago by
comment:1 follow-up: ↓ 2 Changed 11 years ago by
- Description modified (diff)
- Status changed from new to needs_review
comment:2 in reply to: ↑ 1 Changed 11 years ago by
- Status changed from needs_review to positive_review
Replying to vbraun:
it works on MacOSX, and otherwise makes sense, too.
comment:3 Changed 11 years ago by
- Description modified (diff)
- Milestone changed from sage-4.8 to sage-duplicate/invalid/wontfix
- Resolution set to duplicate
- Reviewers set to Jeroen Demeyer
- Status changed from positive_review to closed
Already fixed by #11948, so closing as "duplicate".
Note: See
TracTickets for help on using
tickets.
Initial patch