Opened 22 months ago
Closed 22 months 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)  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:1 Changed 22 months ago by
comment:2 Changed 22 months ago by
 Branch set to u/mforets/22998
 Commit set to 83c1dfc948b2b70bbba60b9db5e48bf9b633461e
 Status changed from new to needs_review
comment:3 Changed 22 months ago by
 Commit changed from 83c1dfc948b2b70bbba60b9db5e48bf9b633461e to ccc99a13ab67806d2d0f1fb7265bbf1cd1d76fff
comment:4 Changed 22 months ago by
 Commit changed from ccc99a13ab67806d2d0f1fb7265bbf1cd1d76fff to 686f1cafe5918cad19db0afb6c9c8ae9a40ac4c8
Branch pushed to git repo; I updated commit sha1. New commits:
686f1ca  fix extra space in message

comment:5 followup: ↓ 6 Changed 22 months 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 in reply to: ↑ 5 Changed 22 months 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 22 months ago by
thanks for pointing out that page. i've added an entry in Tickets to make for future reference.
comment:8 Changed 22 months ago by
 Reviewers set to Ralf Stephan
 Status changed from needs_review to positive_review
Looks good, and tests in relevant directories pass. Please fill in the Authors field.
comment:10 Changed 22 months 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:11 Changed 22 months ago by
 Status changed from positive_review to needs_work
merge conflict
comment:12 Changed 22 months ago by
 Branch changed from u/mforets/22998 to u/rws/22998
comment:13 Changed 22 months ago by
 Commit changed from 686f1cafe5918cad19db0afb6c9c8ae9a40ac4c8 to 49bb25e9beb56bf1bb3669a2c406f99be1d3ff4b
 Status changed from needs_work to positive_review
New commits:
49bb25e  Merge branch 'develop' into t/22998/22998

comment:14 Changed 22 months ago by
 Branch changed from u/rws/22998 to 49bb25e9beb56bf1bb3669a2c406f99be1d3ff4b
 Resolution set to fixed
 Status changed from positive_review to 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!)
as you can see, there are two issues with the line above in this example. it transforms:
into
these are (i) curly braces, (ii) the special function is not transformed properly (no use of the conversions dictionary)