next up previous
Next: Solving Equations Approximately Up: COMMANDS FOR MATH Previous: Plotting Planar Curves

Solving Equations Exactly

 

To solve the system of equations x+y=1, , use

 
solve( {x + y = 1, x^2 - y = 1}, {x,y} );
and we obtain the two sets of solutions.

Now we try a more complicated example. We find the solution of which lies in the first quadrant, and evaluate for this value of , accurate to 8 digits. We start with

solve( {3*x - 2*y=2, x + y^2=7}, {x,y} );
The solution is given in terms of the roots of , which is a quadratic equation, hence has two roots. So our system has two solutions. To obtain the explicit forms of the solutions given via "RootOf" (and to name it mysolns to refer to it later), use
mysolns := allvalues(", 'd');  use quotation mark right of semicolon key
Recall that " refers to the result of the previous computation. (Be careful about the d - see what happens if you drop it, or try ?allvalues). Of these solutions, we want the one for which x,y are positive, so we approximate these solutions using
evalf( mysolns, 4 );
So the first solution is the relevant one. Hence mysolns[1] is to be substituted into . Try
mysolns[1];
subs( mysolns[1], ln(x^2+y^2) );
evalf( ", 8 );



Peter Monk
Tue Aug 29 14:41:29 EDT 1995