Copyright 2001
Department of Mathematics
University of Georgia
Athens, Georgia
John Gosselin
Welcome to Maple - Part 2
Introduction
In the first Welcome to Maple project you learned how to enter expressions, assign variables, define functions and plot functions in Maple. In this project you will learn how to use some other important tools of Maple including the solve and fsolve commands.
The solve command
The
solve
command in Maple is used to solve an equation
algebraically.
Suppose we want to solve the equation
. Of course this equation can be rewritten as a single quadratic equation and we could apply the quadratic formula. Maple will do this for us automatically with the
solve
command. The solve command requires the equation and the variable we wish to solve for.
| > | solve(3*x+3 = x^2-4*x+1,x); |
The equation we just solved had only one variable. Maple can deal with equations involving more than one variable providing the equation can be solved algebraically. For example consider the equation
. Suppose we wanted to solve this equation for
x.
| > | solve(1/(x+k) = k/(x+2*k),x); |
We could also solve this equation for k in terms of x
| > | solve(1/(x+k) = k/(x+2*k),k); |
The first argument of a solve command is normally an equation . If you enter an expression without an equals sign, Maple assumes you are setting the expression equal to zero.
| > | solve(x^2-4,x); |
| > | solve(x^2+4,x); |
The solve command can also work with equations involving functions that have been defined in Maple
| > | f:=x->x^2+7*x-5; solve(f(x)=3,x); |
| > | solve(sin(x)=sin(2*x),x); |
The solve command attempts to solve an equation
algebraically
. There are many equations that cannot be solved algebraically. An example of such an equation is
.
| > | solve(cos(x)=x,x); |
The output indicates that Maple cannot solve this equation.
Maple can be used to solve systems of equations. The system is entered as a set of equations in curly braces and the variables are also entered as a set of variables.
| > | solve({3*x+4*y=2,x=-2*y+3},{x,y}); |
Sometimes Maple stops short of completely solving a single equation or a system of equations.
| > | solve({x^2+y^2=1,y=x^2},{x,y}); |
The following command forces Maple to try as hard as possible to completely solve an equation or system of equations. Note that the command starts with an underscore.
| > | _EnvExplicit:=true; |
| > | solve({x^2+y^2=1,y=x^2},{x,y}); |
Project - Part 1
1) Use the
solve
command to find the point (
x
,
y
) where the lines
and
intersect.
2) Determine the points of intersection of the circle of radius 1 centered at the origin and the circle of radius 4 centered at the point (0,4).
3) Let
k
denote the number of letters in your last name. Determine where the graphs of
and
intersect. Make a plot of these functions. Get a good view so that the points of intersection are clearly indicated.
The fsolve Command
Most equations encountered in the real world cannot be solved algebraically, and one must turn to obtaining good numerical approximations to solutions of such equations. Consider the equation
. A plot of the functions
and
is shown below.
Clearly these graphs intersect at a point ( x , y ) with x between 0 and 1. To get a good approximation of this value of x we use the fsolve command. It is very similar to the solve command except that it tells Maple to solve the equation numerically .
| > | fsolve(cos(x)=x,x); |
As another example consider the equation
. A plot of the functions
and
is shown below. Note that there are apparently two solutions between
x
= 0 and
x
= 3. Basic knowledge of the graphs of these two functions indicates that these are the only solutions.
| > | fsolve(exp(x)=5*x,x); |
Note that when the fsolve command is applied, only one solution is returned. An important feature of the fsolve is that one can specify an interval [ a , b ] on which Maple is to search for a numerical solution. This information is inserted as a third component in the fsolve command. It is entered as a range a .. b .
| > | fsolve(exp(x)=5*x,x,2..3); |
An alternative way of specifying the range is
| > | fsolve(exp(x)=5*x,x=2..3); |
The fsolve command together with the plot command provide a powerful tool for getting numerical solutions of equations. In most cases the plot tool will allow you to determine an x - interval that contains a single solution. Then the fsolve command can be used to get a good numerical approximation to the solution.
Project - Part 2
Define the functions
and
where
k
is the number of letters in your last name. Plot the graphs of these functions in the same window and show that they have two points of intersection. Use the
fsolve
command to determine the points of intersection. The two points of intersection determine a line in the plane. Determine an equation of this line. Express the line as a function of
x
. Plot the graphs of the functions f(x), g(x) and your line in the same window. Adjust the view of the window so that you have a good plot.
Academic Honesty Statement:
Place the following statement (by copying and pasting) at the end of your report and sign it in ink. Your instructor will not grade your report unless this signed statement appears at the end of your report.
I understand that I may work with others if I give them credit in this statement. I also understand that I am required to write my report--that to copy all or part of someone else's report or to allow someone else to copy all or part of my report constitutes plagiarism, which is a serious violation of academic honesty.
I worked with (replace this parenthetical remark with first and last names of those with whom you worked) on this project. I wrote my own report. I did not copy any of this report from anyone else and I did not allow anyone else to copy any of this report.
Signed: