Opened 3 years ago

Closed 3 years ago

#27046 closed defect (invalid)

Integration algorithm 'mathematica_free' is broken

Reported by: gh-JCGoran Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: interfaces: optional Keywords:
Cc: slelievre, slabbe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

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.

Change History (3)

comment:1 Changed 3 years ago by chapoton

  • Cc slelievre slabbe added
  • Component changed from PLEASE CHANGE to interfaces: optional
  • Milestone changed from sage-8.6 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review
  • Type changed from PLEASE CHANGE to defect

fixed in #25501

comment:2 Changed 3 years ago by chapoton

  • Status changed from needs_review to positive_review

comment:3 Changed 3 years ago by embray

  • Resolution set to invalid
  • Status changed from positive_review to closed

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

Note: See TracTickets for help on using tickets.