Group Abstract Group Abstract

Message Boards Message Boards

Manipulate the solutions of an equation solved with Solve?

Posted 9 years ago

I am solving the following equation:

eqn = x^2 - 2*x + 7 == 0;
Solve[eqn, x]
The answer is:
{{x -> 1 - I Sqrt[6]}, {x -> 1 + I Sqrt[6]}}

How I can make use of the solutions?How I can assing to variable a for example the first solution and to variable b the second? Thank you

Posted 9 years ago

Try this

eqn = x^2 - 2*x + 7 == 0;
sols = Solve[eqn, x];
a = x /. sols[[1]];
b = x /. sols[[2]]

You can look up [[ and /. in the help system to try to understand how this works

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard