Hi Andy,

On Tue, Sep 23, 2008 at 12:58 PM, Andy <[EMAIL PROTECTED]> wrote:
>
> I am programming for a project in sage and I want to make use of the
> solve() function.  However, I noticed that solve() does not return the
> value of the solved variable but only a statement instead.
>
> For instance, if I wanted to do solve([x^2 - 1], x), I would likely
> get a result containing the strings "x == 1" and "x == -1".  This is
> all fine if I just want to view the result, but what if I wanted to
> store the resulting possible values of x in a list?  Like have the
> list returned [-1, 1].
>
> Any tricks to solve() that allow the results to be stored in a useable
> form?

The results of solve() are Sage's symbolic equations.  You can get at
their left and right hand sides with lhs and rhs respectively.

sage: eqs = solve([x^2 - 1], x); eqs
[x == -1, x == 1]
sage: [eq.rhs() for eq in eqs]
[-1, 1]

--Mike

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
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