Opened 6 years ago
Closed 6 years ago
#22998 closed enhancement (fixed)
Unable to parse hypergeometric result from mathematica_free
Reported by:  mforets  Owned by:  

Priority:  major  Milestone:  sage8.0 
Component:  calculus  Keywords:  integrate, hypergeometric 
Cc:  rws, kcrisman  Merged in:  
Authors:  Marcelo Forets  Reviewers:  Ralf Stephan 
Report Upstream:  N/A  Work issues:  
Branch:  49bb25e (Commits, GitHub, GitLab)  Commit:  49bb25e9beb56bf1bb3669a2c406f99be1d3ff4b 
Dependencies:  Stopgaps: 
Description
sage: integrate(e^(x^2)*log(x), x, algorithm='mathematica_free') Traceback (most recent call last): ... ValueError: Unable to parse: (x*HypergeometricPFQ[{1/2,1/2},{3/2,3/2},x^2])+(Sqrt[Pi]*Erf[x]*Log[x])/2
Change History (14)
comment:2 Changed 6 years ago by
Branch:  → u/mforets/22998 

Commit:  → 83c1dfc948b2b70bbba60b9db5e48bf9b633461e 
Status:  new → needs_review 
comment:3 Changed 6 years ago by
Commit:  83c1dfc948b2b70bbba60b9db5e48bf9b633461e → ccc99a13ab67806d2d0f1fb7265bbf1cd1d76fff 

comment:4 Changed 6 years ago by
Commit:  ccc99a13ab67806d2d0f1fb7265bbf1cd1d76fff → 686f1cafe5918cad19db0afb6c9c8ae9a40ac4c8 

Branch pushed to git repo; I updated commit sha1. New commits:
686f1ca  fix extra space in message

comment:5 followup: 6 Changed 6 years ago by
notice that this change has an (arguably) adverse effect in test at lines 492495 of symbolic/integration/integral.py
.
indeed, instead of
sage: _ = var('x, y, z') sage: f = sin(x^2) + y^z sage: f.integrate(x, algorithm="mathematica_free") # optional  internet x*y^z + sqrt(1/2)*sqrt(pi)*fresnels(sqrt(2)*x/sqrt(pi))
one has:
sage: _ = var('x, y, z') sage: f = sin(x^2) + y^z sage: f.integrate(x, algorithm="mathematica_free") # optional  internet Traceback (most recent call last): NotImplementedError: Don't know a Sage equivalent for Mathematica function 'FresnelS'.
the new issue is because Fresnel integrals are not implemented in Sage (right?)  in other words, one cannot do much with the former result.
That said, Sage could return a more verbose message like:
"Don't know a Sage equivalent for Mathematica function '%s'. Unable to parse: %s" % m.group() % mexpr
comment:6 Changed 6 years ago by
Replying to mforets:
the new issue is because Fresnel integrals are not implemented in Sage (right?)
Right. You can see all symbolic function tickets at https://trac.sagemath.org/wiki/symbolics/functions
comment:7 Changed 6 years ago by
thanks for pointing out that page. i've added an entry in Tickets to make for future reference.
comment:8 Changed 6 years ago by
Reviewers:  → Ralf Stephan 

Status:  needs_review → positive_review 
Looks good, and tests in relevant directories pass. Please fill in the Authors field.
comment:10 Changed 6 years ago by
do you want me to update (in a new ticket) the doctest from comment:5? the patchbots, do they test with optional  internet
?
comment:12 Changed 6 years ago by
Branch:  u/mforets/22998 → u/rws/22998 

comment:13 Changed 6 years ago by
Commit:  686f1cafe5918cad19db0afb6c9c8ae9a40ac4c8 → 49bb25e9beb56bf1bb3669a2c406f99be1d3ff4b 

Status:  needs_work → positive_review 
New commits:
49bb25e  Merge branch 'develop' into t/22998/22998

comment:14 Changed 6 years ago by
Branch:  u/rws/22998 → 49bb25e9beb56bf1bb3669a2c406f99be1d3ff4b 

Resolution:  → fixed 
Status:  positive_review → closed 
the result i was expecting is the sage object:
maybe one can substitute the line in
mma_free_integrator
:with the some of the code at the mathematica interface in
_sage_
?(we don't need Mathematica to be installed!)