next up previous
Next: About this document ... Up: lab_template Previous: lab_template


Solving Equations with Maple


The purpose of this lab is to find solutions to one equation.

Solving a function or an expression algebraically

You can set an expression or function equal to another expression, function, or number inside a solve command.As an example, you may want to find where the following two parabolas intersect.
> g := 9*x^2-14;
> h:=-x^2;
> plot([g,h],x=-2..2);
> solve(g=h,x);
The plot shows that there are two intersection points and the solve command finds both $x$ values.It is good to get into the habit of naming your output so you can use it in a later command. Giving the $x$ values a name makes it easy to plug them into the function to find the $y$ values.
> ip:=solve(g=h,x);
Since there are two $x$ values called $ip$, use [ ] to call up the one you want.
> subs(x=ip[1],g);
> subs(x=ip[2],h);
Therefore the two intersection points are $(\frac{\sqrt{35}}{5},\frac{-7}{5})$ and $(\frac{-\sqrt{35}}{5},\frac{-7}{5})$. This seems like the answer shown on the graph.

Solving a function or an expression numerically

If you would like to find where the following function crosses the horizontal line $y=-50$ you can try the solve command.
> j:=x->2*x^3-15*x^2-2*x+5;
> k:=x->-50;
> plot([j(x),k(x)],x=-3..8);
The graph shows there should be three answers.
> solve(j(x)=k(x),x);
AAAAAAAAAAAAAARG! That is some scary output! So instead of using the algebraic solve try the numerical fsolve.

Some more strange output

If you want to find where the following function crosses the x-axis, just set it equal to zero.
> f:=theta->-1/2*theta+sin(theta);
> plot(f(theta),theta=-8*Pi..8*Pi);
> solve(f(theta)=0,theta);
Wow, what is that?!?! We know from the graph that there should be three answers and solve wasn't a great option so try fsolve again.
> fsolve(f(theta)=0,theta);
Where are the other two answers!? This is actually how fsolve usually works. It shoots for one answer and only gives that one. But you can tell fsolve where to look by getting an idea from the graph and typing that domain into the fsolve command.
> a:=fsolve(f(theta)=0,theta=-5..-1);
> b:=fsolve(f(theta)=0,theta=-1..1);
> c:=fsolve(f(theta)=0,theta=1..5);
To find the $y$ values just plug in the names of the $x$ values.
> f(a);
> f(b);
> f(c);
(Of course the y-values are zero!)

Systems of Equations

Given two planes $7x+y=z$ and $1-2x+\frac{y}{3}$ you can find the line where they intersect with the solve command. First use plot3d to see the intersection
Notice that the solution can be written in parametric form: $[t,\frac{-27t}{2}+\frac{3}{2},\frac{-13t}{2}+\frac{3}{2}]$ or it may be written symmetrtically as: $x=\frac{3-2y}{27}=\frac{3-2z}{13}$.Note that you can do the algebra for the symmetric form with Maple:
> solve(li[2],x);solve(li[3],x);


  1. Given the expression $\displaystyle x^4-7x^3+7x^2-7x+6$,
    Plot the expression and in text state how many times the it crosses the x-axis.(Experiment with domain values until you find values that show the crossing points clearly.)
    Use the Maple solve command to find the $x$ values of where it crosses the x-axis (also called the roots).
    Use the Maple fsolve command to find the roots.
    State, in text, the value of the roots. Also, how are the results of solve and fsolve different in this problem?
  2. Given the functions $\displaystyle f(x)=\frac{x^2}{2}-3x\cos(x)-10$ and $\displaystyle h(x)=1.4x-9$
    Plot the functions. Again experiment with domain values until the intersection points are clear. Then state in text how many intersection points you see.
    Using the solve command find the intersection points.Label the $x$ values by giving the solve command a name. How many $x$ values does the solve command find?
    Use the fsolve command to find the rest of the answers. Label the $x$ values by giving each fsolve command a name.
    Find all the $y$ values and state the intersection points in text.(When writing your text sentence use only two decimal places for the numbers. Round correctly!)
  3. Find the intersection point of the three planes $x+2y-4=z$, $2-3x-8y=z$, and $5-x+5y=z$. First plot the planes over the domain $0 \leq x \leq 10$ and $-5 \leq y \leq 5$.

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
Jane E Bouchard