Hi,

Pursuant to

http://groups.google.com/group/sage-support/browse_thread/thread/f05932c2048f0ac0/

I am now trying to solve a system of equations using sympy instead of
Maxima to see if sympy's behavior is closer to that of Mathematica.

The following example is from the sympy tutorial (where it works fine
in regular sympy) but is not included in the the Sage documentation on
how to use the sympy interface. Can someone explain what is wrong?

sage: var('x y')
sage: from sympy import solve, Symbol
sage: x = Symbol("x")
sage: y = Symbol("y")
sage: solve(x**4 == 1, x) # fine
[I, 1, -1, -I]
sage: solve([x + 5*y == 2, -3*x + 6*y == 15], [x, y]) # error
---------------------------------------------------------------------------
<type 'exceptions.ValueError'>            Traceback (most recent call
last)

/media/sda4/sage-2.10.2/<ipython console> in <module>()

/media/sda4/sage-2.10.2/local/lib/python2.5/site-packages/sympy/
solvers/solvers.py in solve(eq, syms, simplified)
     98                     equ = eq[i].lhs - eq[i].rhs
     99                 else:
--> 100                     equ = Basic.sympify(eq[i])
    101
    102                 content = collect(equ.expand(), syms,
evaluate=False)

/media/sda4/sage-2.10.2/local/lib/python2.5/site-packages/sympy/core/
basic.py in sympify(a, sympify_lists)
    267                 pass
    268         if a.strip() != a:
--> 269             return Basic.sympify(a.strip())
    270         raise ValueError("%r is NOT a valid SymPy expression"
% a)
    271

/media/sda4/sage-2.10.2/local/lib/python2.5/site-packages/sympy/core/
basic.py in sympify(a, sympify_lists)
    268         if a.strip() != a:
    269             return Basic.sympify(a.strip())
--> 270         raise ValueError("%r is NOT a valid SymPy expression"
% a)
    271
    272     @Memoizer('Basic', MemoizerArg((type, type(None), tuple),
name='type'), return_value_converter = lambda obj: obj.copy())

<type 'exceptions.ValueError'>: '6 y - 3 x == 15' is NOT a valid SymPy
expression
sage:

For some reason, it gets transformed into '6 y - 3 x == 15' instead of
'6*y - 3*x == 15' .

Thanks,
Ben
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to