Opened 6 years ago
Closed 3 years ago
#16801 closed defect (fixed)
Conversion of psi(x,y) to/from SymPy
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage8.1 
Component:  interfaces  Keywords:  _sage_, integrate, sympy 
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Marcelo Forets 
Report Upstream:  N/A  Work issues:  
Branch:  9c4119a (Commits)  Commit:  9c4119a3feda956846bd1fa78256830aef4739f8 
Dependencies:  #20204  Stopgaps: 
Description (last modified by )
integrate(psi(x), x, algorithm='sympy') ... /home/ralf/sage/local/lib/python2.7/sitepackages/sympy1.0py2.7.egg/sympy/core/function.pyc in _sage_(self) 705 import sage.all as sage 706 fname = self.func.__name__ > 707 func = getattr(sage, fname) 708 args = [arg._sage_() for arg in self.args] 709 return func(*args) AttributeError: 'module' object has no attribute 'polygamma'
Previous description:
sage: integrate(1/(x^3 *(a+b*x)^(1/3)), x, algorithm='sympy') ... AttributeError: 'gamma' object has no attribute '_sage_'
Change History (14)
comment:1 Changed 6 years ago by
 Milestone changed from sage6.4 to sageduplicate/invalid/wontfix
 Status changed from new to needs_review
comment:2 Changed 6 years ago by
 Milestone changed from sageduplicate/invalid/wontfix to sage6.4
 Status changed from needs_review to needs_work
Not quite. It appears to be the other direction that's missing.
comment:3 Changed 6 years ago by
I think this naturally needs a general solution that uses the conversions
dictionary given with every special function in Sage.
comment:4 Changed 4 years ago by
 Description modified (diff)
 Keywords sympy added; mpmath removed
 Milestone changed from sage6.4 to sage7.4
 Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.
 Summary changed from not all sympy function results get translated to Sage to Not all sympy function results get translated to Sage
gamma
is now converted from Sympy, the original case however takes very long to doctest. Is there a faster case that returns something with gamma
in Sympy?
Also, additionally now, polygamma
does not convert, as in integrate(psi(x), x, algorithm='sympy')
.
comment:5 Changed 3 years ago by
 Branch set to u/rws/16801
comment:6 Changed 3 years ago by
 Commit set to 9c4119a3feda956846bd1fa78256830aef4739f8
 Dependencies set to #20204
 Milestone changed from sage7.4 to sage8.1
 Report Upstream changed from Not yet reported upstream; Will do shortly. to N/A
 Status changed from needs_work to needs_review
 Summary changed from Not all sympy function results get translated to Sage to Conversion of psi(x,y) to/from SymPy
Last 10 new commits:
a68d57f  23923: Interface cases function with SymPy's piecewise

b80d98c  23923: fix typo

2afa0ee  22566: interface SymPy's ceiling()

9494f6c  22566: add test

8215d37  Merge branch 'develop' into tmp05

7899ea9  20204: convert SymPy abstract functions

b261ec3  23923: fix doctest

5010acf  Merge branch 'u/rws/23923' of git://trac.sagemath.org/sage into t/20204/20204

14b1c52  20204: more doctests

9c4119a  16801: Conversion of psi(x,y) to/from SymPy

comment:7 Changed 3 years ago by
 Status changed from needs_review to needs_work
Could you add at least one direct doctest of the function _sympysage_polygamma
?
comment:8 Changed 3 years ago by
 Status changed from needs_work to needs_review
Since there is no pressing need for it, please open another ticket.
comment:9 Changed 3 years ago by
 Status changed from needs_review to positive_review
LGTM.
all the following more direct tests work. i can add one, but don't know where exactly.
sage: f = 25/12 + psi(5, hold=true); f psi(5) + 25/12 sage: f._sympy_() EulerGamma + 25/6 sage: f.unhold() euler_gamma + 25/6 sage: from sympy import Symbol, polygamma as pg sage: bool(pg(1, x)._sage_().subs(x=1) + 1/6*pi^2 == 0) True
comment:10 Changed 3 years ago by
 Reviewers set to Marcelo Forets
comment:11 Changed 3 years ago by
perhaps in the module's docstring of interfaces/sympy.py
, to add those and maybe other examples, so that they also show up in the htmldoc.
comment:12 followup: ↓ 13 Changed 3 years ago by
Thanks. Please go ahead.
comment:13 in reply to: ↑ 12 Changed 3 years ago by
comment:14 Changed 3 years ago by
 Branch changed from u/rws/16801 to 9c4119a3feda956846bd1fa78256830aef4739f8
 Resolution set to fixed
 Status changed from positive_review to closed
Duplicate of #15057 which however misses
gamma
.