Back to Maple Tutorial Table of Contents
(Before you attempt this lesson, you should be familiar with all previous lessons. This lesson relies heavily on previously discussed material and assumes you are totally familiar with all the material.)
Maple lets you solve equations using the solve command. This is great if you need a quick answer, but what do you do if you need to see the work in between? A good method is to solve it yourself using Maple's equation handling functions.
However, there is a caveat:
If you use this method, you cannot use a function to undo another if the two functions are not inverses. For example:
> x^2=4;
> sqrt(x^2)=sqrt(4);
If we try to simplify that, it gives you this ugly equation that basically means x=[2,-2]. This happens because x2 and the square root of x are not inverses.
It's usually best to only use this trick with linear equations, but, later, we will learn some tricks to overcome this caveat.
Let's take a look at the Maple commands we will use.
lhs(a = b) = a
rhs(a = b) = b
lhs(a + 2x =
) = a + 2x
rhs(a + 2x =
) =
This gives us a nice way to take equations apart and perform algebra on each side. Let's solve a simple, two-step equation to put lhs and rhs in action.
Solve 2x + 2 = 12 for x
> 2*x+2=12; #Enter the eqn into Maple so we can use %
![]()
> lhs(%)-2=rhs(%)-2; #Subtract 2 from both sides. Notice Maple isn't assigning anything because we aren't using :=
![]()
> lhs(%)/2=rhs(%)/2; #Divide both sides by 2
![]()
> solve(2*x+2=12,x); #Let's check our answer by using Maple's automated solver
![]()
Our answer checks out. Let's try a harder equation.
![]()
> (4*x+14)/3=22/3; #Enter the eqn
![]()
> #Notice how Maple broke up the left fraction? It likes to do that.
> lhs(%)*3=rhs(%)*3; #Eliminate the denominators
![]()
> lhs(%)-14=rhs(%)-14; #Subtract 14 from both sides
![]()
> lhs(%)/4=rhs(%)/4; #Finish it!
![]()
Let's try one with trig functions!
![]()
Solve for x
> y=sec(y)+(x/sec(y)); #State eqn
![]()
> lhs(%)-sec(y)=rhs(%)-sec(y); #Subtract sec(y) from both sides
![]()
> lhs(%)*sec(y)=rhs(%)*sec(y); #Multiply both sides by sec(y)
![]()
> expand(lhs(%))=rhs(%); #Let's expand that
![]()
> rhs(%)=lhs(%); #Let's flip it so x is on the left
![]()
Caveat: You can't undo trig functions; you can only move them around!
Let's try one with exponentials.
![]()
> 2^a=2^(b+3);
![]()
> log[2](lhs(%))=log[2](rhs(%)); #Raise both sides to base log2
![[Maple Math]](../images/solve-eq-bh-0123.gif)
> simplify(%); #Maple gave us the change of base formula. This will simplify.
![]()
Note: We can simplify the whole equation as a unit. Be careful; some Maple commands will not take a full equation.
> lhs(%)-3=rhs(%)-3; #Now we can finish it
![]()
> rhs(%)=lhs(%); #Flip it!
![]()
In summary, here's what you can do with lhs and rhs:
c any expression
a = b
|
Operation |
Math Notation |
Maple Syntax |
| Add | a + c = b + c | lhs(%)+c=rhs(%)+c |
| Subtract | a - c = b - c | lhs(%)-c=rhs(%)-c |
| Multiply | ac = bc | lhs(%)*c=rhs(%)*c |
| Divide | lhs(%)/c=rhs(%)/c | |
| Expand/simplify one side | simplify(lhs(%))=rhs(%) lhs(%)=expand(rhs(%)) |
|
| Raise to base c | ca = cb | c^lhs(%)=c^rhs(%) |
| Remove base c | logcca = logccb | log[c](lhs(%))=log[c](rhs(%)) |
| Flip an equation | b = a | rhs(%)=lhs(%) |