Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unable to numerically solve an equation (basic question)

Hello,
I make my first steps with sage and already run into a problem I was not able to solve. When I enter the following:


reset()
var('x')
eqn=x^2+3*x-9==0
sol=solve(eqn,x,solution_dict=true)
sol[x].n(30)
I get the following error message:
The error message is: ('EOF in multi-line statement', (12, 0))

TypeError Traceback (most recent call last)

/home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/all_cmdline.pyc in <module>()

/home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/misc/preparser.pyc in load(filename, globals, attach)
1594 execfile(fpath, globals)
1595 elif fpath.endswith('.sage'):
-> 1596 exec(preparse_file(open(fpath).read()) + "\n", globals)
1597 elif fpath.endswith('.spyx') or fpath.endswith('.pyx'):
1598 import interpreter

/home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/all_cmdline.pyc in <module>()

/home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__index__ (sage/symbolic/expression.cpp:16771)()

/home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._integer_ (sage/symbolic/expression.cpp:4254)()

TypeError: unable to convert x (=x) to an integer


I added the "..." manually for this post.

Obviously I make a severe problem in getting the numerical solution of this simple equation. Maybe you can help me in getting a numerical solution for an equation.

Btw. I get the same error message when I try the example given in the sage tutorial on page 14 ([[s[p].n(30),.....)

Thanks in advance!

click to hide/show revision 2
No.2 Revision

updated 2011-04-02 15:48:55 -0500

kcrisman gravatar image

unable to numerically solve an equation (basic question)

Hello,
I make my first steps with sage and already run into a problem I was not able to solve. When I enter the following:


reset()
var('x')
eqn=x^2+3*x-9==0
sol=solve(eqn,x,solution_dict=true)
reset()
var('x')
eqn=x^2+3*x-9==0
sol=solve(eqn,x,solution_dict=true)
sol[x].n(30)

I get the following error message:


message:

The error message is: ('EOF in multi-line statement', (12, 0))

0)) TypeError Traceback (most recent call last)

last) /home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/all_cmdline.pyc in <module>()

<module>() /home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/misc/preparser.pyc in load(filename, globals, attach)
<br> 1594 execfile(fpath, globals)
globals)<br> 1595 elif fpath.endswith('.sage'):
fpath.endswith('.sage'):<br> -> 1596 exec(preparse_file(open(fpath).read()) + "\n", globals)
globals)<br> 1597 elif fpath.endswith('.spyx') or fpath.endswith('.pyx'):
fpath.endswith('.pyx'):<br> 1598 import interpreter

interpreter<br> /home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/all_cmdline.pyc in <module>()

<module>() /home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__index__ (sage/symbolic/expression.cpp:16771)()

(sage/symbolic/expression.cpp:16771)() /home/.../sage-4.6.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._integer_ (sage/symbolic/expression.cpp:4254)()

(sage/symbolic/expression.cpp:4254)() TypeError: unable to convert x (=x) to an integer


integer

I added the "..." manually for this post.

Obviously I make a severe problem in getting the numerical solution of this simple equation. Maybe you can help me in getting a numerical solution for an equation.

Btw. I get the same error message when I try the example given in the sage tutorial on page 14 ([[s[p].n(30),.....)

Thanks in advance!