ONLINE LESSON 2

This lesson covers sections 4.5 and 4.6 in the book: the topics are solutions of exponential and logarithmic equations and applications (exponential growth and decay problems).

Our first topic is the solution of exponential equations (equations involving exponential functions). The natural thing to do with an exponential

equation is to take the logarithm of both sides (though we shall see some examples below where different strategies are needed).

`> `
**equation1 := 2^x = 7:**

`> `
**equation1;**

`> `
**equation2:= map(ln,equation1): equation2; #This command tells Maple to take the natural logarithm of both sides of the equation.**

`> `
**equation3:=simplify(equation2):equation3; #Then we simplify it.**

`> `
**solve(equation3,x); #We let Maple solve the equation for x -- we know how to do this!**

We could have used the logarithm to the base 2. Maple represents this by log[2]. However, notice that Maple displays general logarithms

using the natural logarithm and the change of base formula:

`> `
**log[2](x);log[17](5);**

`> `
**equation4:=map(log[2],equation1):equation4;**

`> `
**equation5:=simplify(equation4):equation5;**

But one might as well use the same logarithm all the time. Look at a problem like this with more than one base involved. There's no special

advantage to using logarithms to the base 2 or 3 in this problem: we might as well use ln.

`> `
**equation6:=3^(x+2)=2^(2*x-5):equation6;**

`> `
**equation7:=map(ln,equation6):equation7;**

Maple wants to do a couple of steps at once next -- first it applies laws of logarithms, then it expands the results using the distributive law. I force

it to show work more like what you are likely to do by making it "factor" the equation it wants to present.

`> `
**equation8a:=map(factor,simplify(equation7)):equation8a; **

`> `
**equation8:=simplify(equation7):equation8; #Notice Maple does this straight from equation 7 without using our equation 8a.**

The next Maple command subtracts x*ln(3) from both sides of the equation and adds 5log(2) to both sides of the equation.

`> `
**equation9:=map(a->a-x*ln(3)+5*ln(2),equation8):equation9; **

Next we factor both sides of the equation -- but of course only one side really factors.

`> `
**equation10:=map(factor,equation9):equation10; **

Divide both sides by 2*ln(2)-ln(3).

`> `
**equation11:=map(a->a/(2*ln(2)-ln(3)),equation10):equation11; **

`> `
**solve(equation6,x); #Notice that Maple can solve equation 6 for x entirely on its own!**

We look at another kind of equation.

`> `
**e:=exp(1); evalf(e); #We give the letter e the numerical value we expect.**

`> `
**equation12:=simplify(e^(2*x)-3*e^x+2=0):equation12;**

The secret is to recognize that this is a quadratic equation in disguise.

Here is a quadratic equation, something we know how to solve.

`> `
**equation13:=u^2-3*u+2=0:equation13; **

Substitute u = e^x into the quadratic equation...

`> `
**u:=e^x: equation13; **

and this is the same as our original equation when simplified.

`> `
**equation14:=simplify(equation13):equation14; **

This equation can be solved by factoring.

`> `
**equation15:=simplify(map(factor,equation13)):equation15; **

This quantity will be equal to zero if one of its factors is equal to zero, that is, if either e^x-1 = 0 or e^x-2 = 0.

`> `
**equation16:=simplify(e^x-1=0):equation16;**

`> `
**equation17:=map(a->a+1,equation16):equation17;**

`> `
**solve(equation17,x);**

`> `
**equation18:=simplify(e^x-2 = 0):equation18;**

`> `
**equation19:=map(a->a+2,equation18):equation19;**

`> `
**solve(equation19,x);**

The solutions are x = 0 or x = ln(2). Notice that Maple also knows how to solve this problem all by itself:

`> `
**solve(equation12,x);**

Here is another kind of equation which calls on us to combine techniques of solving polynomial equations with facts about the

exponential function in a different way.

`> `
**equation13:=x^2*e^x+2*e^x=3*x*e^x;**

Bring all terms to the same side of the equals sign.

`> `
**equation14:=map(a->a-3*x*e^x,equation13):equation14;**

Factor.

`> `
**equation15:=map(factor,equation14):equation15;**

The only way the left side of this equation can equal zero is if one of its factors is equal to zero. But e^x is always positive, no matter what x is,

so the only solutions are x = 1 or x = 2.

`> `
**solve(equation15,x);**

Maple can do this entirely on its own...

`> `
**solve(equation13,x);**

`> `

`> `

`> `

`> `

Now we turn our attention to equations involving the logarithm. The usual strategy would be to apply an exponential function to both sides.

`> `
**equation16:=log10(3*x+5) = 2:equation16; #Maple wants to present everything in terms of ln**

`> `
**equation17:=map(a->10^a,equation16):equation17;**

`> `
**equation18:=simplify(equation17):equation18;**

`> `
**x=solve(equation18,x); #This is ordinary algebra which we can let Maple do.**

Things get interesting when the multiplication rule for logarithms needs to be applied.

`> `
**equation19:=ln(x)+ln(x-1) = ln(4*x):equation19;**

`> `
**equation20:=map(exp,equation19):equation20;**

`> `
**equation21:=simplify(equation20):equation21;**

A more natural way to do this, which it is harder to get Maple to do, is to apply the rule for sums of logarithms:

ln(x) + ln(x-1) = ln(4*x)

ln(x(x-1)) = ln(4*x)

x(x-1) = 4*x

which gets us to the same place.

`> `
**equation22:=map(a->a-4*x,equation21):equation22;**

`> `
**equation23:=sort(expand(equation22)):equation23;**

`> `
**solve(equation23,x); #We know how to solve this.**

But it is important to observe that equation 19 is not true if we set x = 0.

`> `
**subs(x=0,equation19); #ln(0) is undefined, and so is ln(-1)!!!**

It is true if we set x=5.

`> `
**subs(x=5,equation19); map(simplify,%); evalb(%);**

`> `
**solve(equation19,x); #Maple recognizes the extraneous root this time (it does not give 0 as a solution). But it is not reliable about this, as we will see in the next example.**

So we have an "extraneous root". The "extraneous root" is introduced at the step where we apply the exponential function to both sides: the

values of the exponential function are always positive, but the equation x *(x-1) = 4*x has a solution which is not positive.

In the "more natural" approach using laws of logarithms, that is still the place where the problem comes in. ln(x*(x-1)) = ln(4*x)

only makes sense when 4*x (and so x) is positive, while x*(x-1) = 4*x makes sense (and has solutions) when x is non-positive.

This is important enough that I will do another example.

`> `
**equation24:=log[5](x-1) - log[5](x+1) = 2: equation24;**

`> `
**equation25:=map(a->5^a,equation24):equation25; #put both sides over the base 5.**

`> `
**equation26:=simplify(equation25):equation26;**

Notice that this is the same equation you would get by applying laws of logarithms -- log[5](x-1) - log[5](x+1) = log[5]((x-1)/(x+1)), because

log[a](A) - log[a](B) = log[a](A/B) (a difference of logarithms is the logarithm of a quotient).

Your work would be more likely to look like this:

log[5](x-1) - log[5](x+1) = 2

log[5]((x-1)/(x+1)) = 2

(x-1)/(x+1) = 5^2 = 25

`> `
**equation27:=map(a->a*(x+1),equation26):equation27; #multiply both sides by x+1**

`> `
**x=solve(equation27,x);**

This value of x cannot be subsituted sensibly into the original equation: x-1 will be negative (since x is negative) so log[5](x-1)

will certainly be undefined (in fact, x+1 is negative, too). So the only "solution" we get is extraneous, and this equation has no solutions at all.

`> `
**subs(x=-13/12,equation24); #this clearly makes no sense!**

`> `
**solve(equation24,x); #But, alas, Maple doesn't realize this!**

Section 4.6: Applications of Exponential and Logarithmic Equations (exponential growth and decay problems).

One kind of problem we gain the ability to solve is more sophisticated compound interest problems.

Suppose we invest $15,000 at 5% interest compounded annually

. How long will it take for our money to triple (to get a value of $45,000).

`> `
**P:=15000;**

`> `
**r:=.05;**

`> `
**solve(P*(1+r)^(t) = 45000,t); #Maple solves this in one fell swoop.**

Let's take that again, a little more slowly.

`> `
**P:=15000;**

`> `
**r:=.05;**

`> `
**equation31:=P*(1+r)^t = 45000:equation31;**

`> `
**equation32:=map(a->a/15000,equation31):equation32; #divide both sides by 15000**

`> `
**equation33:=map(ln,equation32):equation33; #take the natural logarithm of both sides.**

`> `
**equation34:=simplify(equation33,assume=positive):equation34;**

The form you would be much more likely to write here is t*ln(1.05) = ln(3) (applying laws of logarithms); Maple wants to evaluate the logarithm.

`> `
**ln(1.05); #because 1.05 is in decimal form, Maple assumes we want "calculator approximations".**

`> `
**equation35:=map(a->a/ln(1.05),equation34):equation35;**

`> `
**evalf(20.49593431*ln(3)); #the evalf function of Maple does numerical approximations of expressions**

Suppose the interest was compounded quarterly instead of annually.

`> `
**P:=15000;**

`> `
**r:=.05;**

`> `
**equation36:=P*(1+r/4)^(4*t)=45000;**

`> `
**equation37:=map(a->a/15000,equation36):equation37; #divide both sides by 15000.**

`> `
**equation38:=map(ln,equation37):equation38; #take the natural logarithm of both sides.**

`> `
**equation39:=simplify(equation38,assume=positive):equation39; #simplify. The "assume=positive" bit is a Maple technicality which makes it smarter about logarithms.**

For equation39, we would normally write 4t*ln(1.0125) = ln(3). This is Maple being an "eager beaver" about evaluation:

`> `
**evalf(4*ln(1.0125)); #this shows where the weird number in equation 39 comes from!**

`> `
**equation40:=map(a->a/(4*ln(1.0125)),equation39):equation40;**

`> `
**evalf(20.12474120*ln(3)); #and here is our numerical answer!**

They might take away my Maple license if I didn't demonstrate that Maple can solve this in one step:

`> `
**equation36;**

`> `
**solve(equation36,t);**

Now we look at problem 11 in the book. The population of a city was 112000 in 1994, which we will call time zero.

`> `
**pop0 := 112000;**

`> `
**r:=.04; #the problem tells us that the rate of growth is 4 percent per year.**

`> `
**pop:=pop0*e^(.04*t); #this is the formula for population t years after 1994.**

`> `
**t:=2000-1994; #set the time to the year 2000.**

`> `
**pop; #evaluate the population expression for this value of t.**

`> `
**evalf(pop); # get a numerical value.**

`> `
**t:=evaln(t); #this eliminates our assumption that t is 6.**

`> `
**solve(pop=200000,t); #Maple can solve the problem of when the population will be 200000 on its own.**

`> `
**1994+14.49546238; #it will happen in 2008.**

`> `

We had better take that last part over again.

`> `
**equation41:=pop=200000:equation41;**

`> `
**equation42:=map(a->a/112000,equation41):equation42; #divide both sides by 112000.**

`> `
**equation43:=map(ln,equation42):equation43; #take the natural logarithm of both sides.**

`> `
**equation44:=simplify(equation43,assume=positive):equation44;**

What we would naturally do is write .04*ln(t) = ln(25/14). It's an easy exercise in laws of logarithms to show that the mess of logarithms on the

right is the same thing as ln(25/14).

`> `
**equation45:=map(a->a/.04,equation44):equation45;**

`> `
**evalf(50.00000000*ln(5)-25.00000000*ln(2)-25.00000000*ln(7));**

We have our numerical answer.

`> `

A more sophisticated exponential growth problem:

A culture of bacteria is growing exponentially. We have the following data: after 3 hours, there are 2500 bacteria, while after 7 hours, there are 150,000

bacteria. Giuve a formula for the number of bacteria after time t. How many bacteria were there at time 0? How many will there be after 24 hours?

`> `
**r:=evaln(r); #this frees up the previously used variable r.**

`> `
**P:=P0*e^(r*t); #formula for population at time t.**

The following two equations represent the facts we are given: they are obtained by substituting the values t=3 and t=7 into the formula and equating the resulting

formulas to the known values of P.

`> `
**equation46:= subs(t=3,P) = 2500: equation46;**

`> `
**equation47:= subs(t=7,P) = 150000: equation47;**

`> `
**P0:=solve(equation46,P0); #we replace P0 with the result of solving equation 46 for P0.**

`> `
**equation47; #we look at the new form of equation 47 (obtained by plugging in the value for P0 obtained in the previous step).**

`> `
**equation48:=simplify(equation47): equation48; #simplify (using rules of exponents)**

`> `
**equation49:=map(a->a/2500,equation48):equation49;**

`> `
**equation50:=map(ln,equation49):equation50;**

`> `
**equation51:=simplify(equation50,assume=positive);**

Maple insists on "simplifying" ln(60) to

`> `
**equation52:=map(a->a/4,equation51): equation52;**

`> `
**map(evalf,equation52);**

At this point, we have solved for the rate constant r.

`> `
**r:=1.023586140;**

`> `
**P0; #here's our formula for the initial population with the new value for r substituted in.**

`> `
**P0:=evalf(P0); #and here is a numerical value.**

`> `
**P:=P0*e^(r*t); #the formula for population at time t**

`> `
**subs(t=0,P); #substitute in t=0.**

`> `
**evalf(subs(t=24,P)); #substitute in t = 24 and evaluate. Billions and billions!**

Now we look at a "half-life" problem.

`> `
**P:=evaln(P); r:=evaln(r); P0:=evaln(P0); #we free up previously used variables**

The general half-life problem is this:

`> `
**equation53:=(1/2)*P0 = P0*e^(-r*t):equation53; #how much time does it take for the amount P, decaying with rate r, to decrease to half its starting value?**

`> `
**equation54:=map(a->a/P0,equation53): equation54; #divide both sides by P0.**

`> `
**equation55:=map(ln,equation54):equation55;**

`> `
**equation56:=simplify(equation55,assume=positive): equation56;**

`> `
**solve(equation56,r);**

The half-life of a radioactive substance decaying at rate r is ln(2)/r. This is symmetrical: the rate of decay of a radioactive substance with half-life

h is ln(2)/h:

`> `
**solve(h = ln(2)/r,r); #solve the equation h = ln(2)/r for r to get rate r in terms of half-life h.**

We work problem 21 from the book. The half-life of cesium 137 is 30 years. Suppose we have a ten gram sample.

Find a formula for the mass remaining after t years.

How much will remain after 80 years?

After how long will only 2 g remain?

`> `
**t:=evaln(t);**

`> `
**r:=evalf(ln(2)/30); #we use the formula to compute the rate of decay. evalf gives us a numerical answer.**

`> `
**P0:=10; #we started with ten grams.**

`> `
**P:=P0*e^(-r*t); #this is our formula**

`> `
**subs(t=80,P);evalf(%); #We find the amount left after 80 years by plugging in 80 for t.**

`> `
**equation57:= 2 = P: equation57; #we set up the equation to solve for the last part.**

`> `
**equation58 := map(a->a/10,equation57): equation58;**

`> `
**equation59:=map(ln,equation58): equation59;**

`> `
**equation60:=simplify(equation59,assume=positive): equation60;**

`> `
**solve(equation60,t); #it takes about 70 years for the 10 g of cesium to decay to 2 g.**

`> `