Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration algorithm 'mathematica_free' is broken #27046

Closed
JCGoran mannequin opened this issue Jan 11, 2019 · 2 comments
Closed

Integration algorithm 'mathematica_free' is broken #27046

JCGoran mannequin opened this issue Jan 11, 2019 · 2 comments

Comments

@JCGoran
Copy link
Mannequin

JCGoran mannequin commented Jan 11, 2019

Wolfram has most likely changed their website layout since the last time this was updated as I am receiving the following error for even the simplest integrands:

sage: integrate(x**2,x,algorithm='mathematica_free')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-24-8d4613b1d0e0> in <module>()
----> 1 integrate(x**Integer(2),x,algorithm='mathematica_free')

sage-8.4/local/lib/python2.7/site-packages/sage/misc/functional.pyc in integral(x, *args, **kwds)
    751     """
    752     if hasattr(x, 'integral'):
--> 753         return x.integral(*args, **kwds)
    754     else:
    755         from sage.symbolic.ring import SR

sage-8.4/local/lib/python2.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.integral (build/cythonized/sage/symbolic/expression.cpp:69368)()
  12399                     R = ring.SR
  12400             return R(integral(f, v, a, b, **kwds))
> 12401         return integral(self, *args, **kwds)
  12402
  12403     integrate = integral

sage-8.4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.pyc in integrate(expression, v, a, b, algorithm, hold)
    814         if not integrator:
    815             raise ValueError("Unknown algorithm: %s" % algorithm)
--> 816         return integrator(expression, v, a, b)
    817     if a is None:
    818         return indefinite_integral(expression, v, hold=hold)

sage-8.4/local/lib/python2.7/site-packages/sage/symbolic/integration/external.pyc in mma_free_integrator(expression, v, a, b)
     95     params = urlencode({'expr': expression._mathematica_init_(), 'random': 'false'})
     96     page = urlopen("http://integrals.wolfram.com/home.jsp", params).read()
---> 97     page = page[page.index('"inputForm"'):page.index('"outputForm"')]
     98     page = re.sub(r"\s", "", page)
     99     mexpr = re.match(r".*Integrate.*==</em><br/>(.*)</p>", page).groups()[0]

ValueError: substring not found

There seems to be a dedicated API available at https://products.wolframalpha.com/api/, but it requires login. Alternatively, the new site returns the output in JSON format, so maybe parsing it directly could be viable.

CC: @slel @seblabbe

Component: interfaces: optional

Issue created by migration from https://trac.sagemath.org/ticket/27046

@JCGoran JCGoran mannequin added this to the sage-8.6 milestone Jan 11, 2019
@JCGoran JCGoran mannequin added the p: major / 3 label Jan 11, 2019
@fchapoton
Copy link
Contributor

comment:1

fixed in #25501

@fchapoton fchapoton removed this from the sage-8.6 milestone Jan 11, 2019
@embray
Copy link
Contributor

embray commented Feb 26, 2019

comment:3

Presuming these are all correctly reviewed as either duplicate, invalid, or wontfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants