Ask Your Question
0

How to use the second solution of an equation?

asked 2014-09-10 15:40:28 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi, I'm new to Sage and have the following question:

After solving an equation, Sage gives me two possible solutions:

sage: solve((vMax-v0) == (DeltaV11+DeltaV13), aMax)

[aMax == -sqrt(1/2a0^2 - j(v0 + j(vMax), aMax = sqrt(1/2a0^2 - j(v0 + j(vMax)]

For the further calculations, I have to use the second one. How can I do that?

Thank you for your help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-09-10 16:07:10 +0100

rws gravatar image

updated 2014-09-10 16:08:11 +0100

It's a Python list:

sage: sol=solve(x^2==1,x)
sage: sol
[x == -1, x == 1]
sage: sol[0]
x == -1
sage: sol[1]
x == 1
edit flag offensive delete link more
0

answered 2014-09-10 16:09:39 +0100

ndomes gravatar image

solve returns a list of equations (or a list of lists of equations)

Assign to a name (for example sol)

sol = solve(x^2 == 4 , x)
sol 

[x == -2, x == 2]

Access to the equations in the list

First, second, last:

sol[0] ; sol[1] ; sol[-1]

x == -2
x == 2
x == 2

Access to the right hand side of the second equation:

sol[1].rhs()
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2014-09-10 15:40:28 +0100

Seen: 275 times

Last updated: Sep 10 '14