Ask Your Question
2

Error while Integrating with mathematica algorithm

asked 2017-03-18 08:41:20 -0500

Romuald_314 gravatar image

updated 2017-03-18 08:44:47 -0500

Hi,

Trying once more to integrate with the mathematica algorithm since a long time - did work before - I realized that now it gives me an error:

integrate(10*x-3, x, algorithm="mathematica_free")

And it returns

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_12.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW50ZWdyYXRlKDEwKngtMywgeCwgMSwgMywgYWxnb3JpdGhtPSdtYXRoZW1hdGljYV9mcmVlJyk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmp0ZIVPP/___code___.py", line 3, in <module>
    exec compile(u"integrate(_sage_const_10 *x-_sage_const_3 , x, _sage_const_1 , _sage_const_3 , algorithm='mathematica_free')" + '\n', '', 'single')
  File "", line 1, in <module>

  File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/misc/functional.py", line 664, in integral
    return x.integral(*args, **kwds)
  File "sage/symbolic/expression.pyx", line 11660, in sage.symbolic.expression.Expression.integral (/usr/lib/sagemath//src/build/cythonized/sage/symbolic/expression.cpp:64426)
  File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 771, in integrate
    return integrator(expression, v, a, b)
  File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py", line 67, in mma_free_integrator
    page = page[page.index('"inputForm"'):page.index('"outputForm"')]
ValueError: substring not found

A "substring not found". Oh. What does it mean and how am I supposed to fix that? I add it totally worked before.

Thanks

edit retag flag offensive close merge delete

Comments

The integrals Wolfram website may have changed its format again?

kcrisman gravatar imagekcrisman ( 2017-03-18 08:45:42 -0500 )edit

That's what I thought. Actually, I haven't been using this algorithm since... I began using sage. So, it had indeed time to change in the meanwhile. But it seems like sage and its scripts can't find the instructions (kind of a protocol) to call mathematica on the internet... rather than mathematica returning an error.

Romuald_314 gravatar imageRomuald_314 ( 2017-03-18 08:49:17 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-03-18 15:55:14 -0500

The name of the website page has changed from "index.jsp" to "home.jsp". I've submitted a Trac ticket to fix that. If you know how to build Sage from source you can fix it on your copy as well or wait for Sage 8.0 (next version after soon-to-be-released 7.6).

edit flag offensive delete link more

Comments

I can simply modify the /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py file.

Romuald_314 gravatar imageRomuald_314 ( 2017-03-18 16:39:05 -0500 )edit

... and I as just tested, it seems to work but now I have the same error on the line just after:

page = re.sub("\s", "", page)
ValueError: substring not found
Romuald_314 gravatar imageRomuald_314 ( 2017-03-18 16:48:09 -0500 )edit

That's peculiar, since I don't have any errors after the fix. Did you rebuild using sage -b before running?

paulmasson gravatar imagepaulmasson ( 2017-03-18 17:25:06 -0500 )edit

@paulmasson - nice work!

kcrisman gravatar imagekcrisman ( 2017-03-18 19:54:53 -0500 )edit

No, I didn't rebuild anything. I simply noticed that the modifications brought to the .py file were immediately taken into account.

Romuald_314 gravatar imageRomuald_314 ( 2017-03-19 03:22:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-18 08:41:20 -0500

Seen: 81 times

Last updated: Mar 30