I want to take the numerical solution of a variable in a system of equations and use it later in the program. But all I can get is the symbolic definition. Here's a simplified example of the problem.
I assume the syntax for solving the system is correct because I get the right answers but I want v = 1, not v = x. Thanks.
I see what you are doing. Remember, Sage is Python too! So
is one way. Notice that here
Let us know if this answers the question you have.
posted Feb 16 '11kcrisman
7812 ● 20 ● 78 ● 170
You're almost there -- you just need to save the output of the
The output is a list, whose contents are solutions and multiplicities. In this case the solution has multiplicity 1, so the list contains a single item, which is another list -- that list is the list of expressions which constitutes a solution.
Now to get the value itself, you need to just take the right hand side of that expression:
Note that you don't have to define all these intermediate variables if you don't want to -- I just did it to make the explanation a little clearer:
Using the other entries in the
Great, thanks for the help. I'm a social scientist who's trying to teach himself sage and python (and to use it for my work). The last time I had a computer science course Pascal was the in thing ;) RAC
posted Feb 16 '11RAC
11 ● 1 ● 3
Asked: Feb 16 '11
Seen: 489 times
Last updated: Feb 16 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.