Lab Eight: and L'Hospital's Rule Monday, April 01, 2013 7:05 PM

Related Rates One (about 20 minutes): I'd like to start this lab by taking a brief step back to related rates. Start by going to this web page and explore: http://demonstrations.wolfram.com/RelatedRatesABoatApproachingADock/ The webpage has no explanation of the in the upper right corner. You and your group should figure out the equation for this curve. If you don't have the answer within 20 minutes ask for my help.

L'Hospital's Rule (about 40 minutes): If we have two functions and that both go to infinity as , we say that dominates as if 〖lim〗_(x→∞)⁡〖 (f(x))/(g(x))=∞〗 or, equivalently if 〖lim〗_(x→∞)⁡〖 (g(x))/(f(x))=0〗.

1. Convince yourself using L'Hospital's rule that dominates as .

2. Use Mathematica to graph , , and for and then for .

It should be clear that the is quickly outstripping the quadratic. Why does the third curve look so much like the first, but right shifted about 4 spaces over?

3. Graph alone over the domain Hopefully, it's fairly clear from the graph that this

ratio is going to infinity as x is going to infinity.

Notice that even though the behavior in the numerator is quite a bit different, in this case, the end result is similar when we examine what happens as goes to 0:

4. Explain why you can't use L'Hospital's rule to calculate , then calculate it anyway using

another technique. 5. Go to http://demonstrations.wolfram.com/LHospitalsRuleFor00Forms/ and play around with the Mathematica example until you have a decent feel for what it means. 6. Produce three examples where the numerator (f[x]) and the denominator(g[x]) go to infinity as x goes to 1, but

a.

b.

c. DNE

Let's get a little bit more practice using the symbolic manipulation features of Mathematica and review the [] command:

(Note: to make the infinity symbol you can type inf) Not too surprisingly you get the answer you expect. Now replace with 0 in the Limit[] command and check your result from step 4.

Take a moment to appreciate how useful this technique is by finding the answer to a few of your homework problems… Be sure to get the parenthesis and underscores correct when you define new values of f[x] and g[x]. (Of course to get credit you'll have to show the work, but now you can be

Calculus Page 1 values of f[x] and g[x]. (Of course to get credit you'll have to show the work, but now you can be certain you have the proper answer). Now notice (and you *might* find this useful too) that you can calculate the following:

Then use Mathematica like this:

When using this to help you with L'Hospital's rule you might want to calculate f'[x] and g'[x] separately because Mathematica will simplify f'[x]/g'[x] if it can which might result in you leaving out steps in your work. Notice that in the last example the form was still indeterminate. So calculate the following:

The form is no longer indeterminate and the limit should be easy to calculate.

Recall that adding to the list of arguments for Limit[] makes it the left-handed limit and adding makes it the right-handed limit (you'll need it later).

6. Explain, using L'Hospitals rule, why any rational function whose denominator has greater degree than numerator has a horizontal asymptote at . 7. Similarly, why does every rational function with numerator and denominator of the same degree have a finite horizontal asymptote? 8. And finally, why is the end behavior of a rational expression with numerator of higher degree than denominator going to be infinity or negative infinity?

Indeterminate Products Redefine f[x] and g[x] to be x and ln(x) respectively and use Mathematica to find the limit as of . Mathematica has no difficulties with this, but you should recognize an indeterminate product (please review pg 302 if necessary).

9. Explain why the limit as x goes to zero from the left is not defined. 10. Use Mathematica to find the limit 11. Warning: Even if you use the wrong Direction Mathematica will find a limit for this product… which is a bit surprising because Log[] is undefined for negative x, at least for us, However Mathematica does a variety of surprising things, try calculating Log[-1]. OOOO…. So Mathematica is a tad more sophisticated than we are, but that's ok… we just need to check our results with common sense.

12. Explain why , although an won't help as much as in calculating the

limit as of . 13. Plot all three of the following on : a. b. c. The graph of should convince you of the value of 14. Now use L'Hospitals rule (combined with a bit of algebraic manipulation) to formally find . 15. Now do problems 64-68 on page 305 with your group (nothing needs to be turned in for this).

Another look at the (and lots of practice with Mathematica conventions) Now we are going to leverage most of the techniques that we have learned to generate a visual representation of how the Mean Value Theorem works in complete almost complete generality. Here is the basic idea of how this will work: • Store a function in f[x] • Store the endpoints of the closed [a,b] in the variables a and b

Calculus Page 2 • Store the endpoints of the closed interval [a,b] in the variables a and b • Let S[x] store the secant between the points (a,f[a]) and (b,f[b]) • Use Nsolve[] (numeric solve) to find the locations at which the of the line is parallel to that of the secant line • Extract the first solution (because there may be more than one) and use that to generate the equation of the tangent line stored in L[x] So, let's get to work. Let's begin by storing in f[x] and then plotting the results to see what we get:

The next step is to store the endpoints of [-3,1] and figure out (symbolically) the function for the secant line:

Your graph should look something like this:

Make sure you understand completely how S[x] is defined. In particular, notice that a and b are holding values, so they're really constants-- see if you can figure out which parts in the Mathematica formula correspond to this equation: y = (x-a) + f(a) Lets get fancy add some easy to see marks denoting the two points on f[x] that we used to define the secant line… they're not strictly speaking necessary, but the secant line does cross the curve f[x] in more than two locations so it will be nice to see clearly:

Calculus Page 3 Pay close attention to what I've done up above. The two ' graphs (y=f[x], and y=S[x]) are stored in the variable Curves, and the two points are stored in Points. The semicolons suppress output. Try the command without semicolons. Ugly isn't it?

This command will find every input that generates the correct slope:

Give it a try. There is, however, a problem. The command above will NOT check that your answer(s) are in the proper closed interval [a,b]. So we are going to have to be a bit more clever to make this fully automated. This next bit is okay to just type without understanding all the details, but, for those interested, here's the idea: • We store the results of NSolve in a list of replacement rules (this is how Mathematica normally works and that's why you solutions from up above look like this:

• We convert that list of substitution rules into a list of numbers using the /. operation (that applies a substitution rule on the right to the expression on the left • Then we use the Select[] command on the list of numbers and extract the first one that is in our desired interval. That third step is hard to read because it uses something called a pure function to test the list of numbers and find the first one that we want. The basic syntax is Select[, , ] Since the result returned from Select[] is a list (even if it's a list of 1) we need to use the double bracket notation to extract the first element.

At each step along the way we store the intermediate results in a variable for later use (Solutions will hold the results of NSolve[], xValues will hold the list of numbers and c will hold the first one in [a,b]). So put them all together:

Okay… now let's define the equation for the tangent line:

Now put everything together and make a few changes to this program:

So that the graph looks like this:

Calculus Page 4 So that the graph looks like this:

Note: you will only need to make two small changes-- one to the line starting with Curves=, and the other to the line starting with Points=.

Let's go for full glory and wrap this in a manipulate statement so that we can move the endpoints of the secant line:

Pay particular attention to what happens when you move a to -1.

Calculus Page 5