MATH 1170: Calculus for Biologists I (Fall 2010)

advertisement
MATH 1170: Calculus for Biologists I (Fall 2010)
Lab Meets: November 16, 2010
Report due date: November 23, 2010
Section 002: Tuesday 9:40−10:30am
Section 003: Tuesday 10:45−11:35am
Lab location − LCB 115
Lab instructor − Erica Graham, graham@math.utah.edu
Lab webpage − www.math.utah.edu/~graham/Math1170.html
Lab 10
General Lab Instructions
In−class Exploration
Review: In last week’s lab, we analyzed the stability of equilibria of discrete−time systems, comparing our
mathematical results to graphical ones obtained via cobwebbing. We also saw how the stability properties
can changed based on the parameters of a model.
Background: This time, we will see how we can approximate the behavior of a function. This will include
leading behaviors, as well as tangent line approximations at a particular point.
restart;
In Lab 01, we looked at a pharmacodynamic model of drug effect as a function of the concentration of drug
within the bloodstream. We’ll revisit this concept, in a slightly modified way. Suppose we have a highly
effective drug that also has relatively severe side effects. We can model the percentage drug effect as the
function E(c) = 1200*c/(c^3+16).
E:=c−>4800*c/(c^3+128);
4800 c
E := c
(2.1)
c3 128
If we plot E(c) over a range of concentrations, we can get an idea of what the ultimate effect looks like.
plot([E(c)],c=0..50,0..100,labels=["concentration","% drug
effect"]);
100
80
60
% drug effect
40
20
0
0
10
20
30
40
concentration
50
For very small concentrations, it looks like the drug effect increases dramatically, until a maximum of 100
is reached. At this point, the effect begins to decline toward zero. We can interpret this as higher
concentrations of the drug being better for you, until a certain threshold, at which point side effects start to
kick in.
We can use the concept of "leading behavior" to estimate how the drug effect behaves for very small
concentrations and for very large ones. To begin, we’ll determine the leading behavior at c = 0. Looking at
the model for E(c), it appears that the numerator remains the same for small c, and the denominator behaves
like the constant 128. Let’s call the leading behavior function at c=0 E0(c).
E0:=c−>4800*c/128;
75
c
(2.2)
2
Similarly, we can determine the leading behavior of E(c) at infinity (i.e. very high concentrations). As c
tends to infinity, the numerator of E(c) remains the same, whereas the denominator is dominated by c^3.
Let’s call the resulting function E_inf(c).
E_inf:=c−>4800*c/(c^3);
4800 c
E_inf := c
(2.3)
c3
Now we can plot our original function, E(c), along with our approximations at either end of our domain on
the same set of axes.
plot([E(c),E0(c),E_inf(c)],c=0..50,0..200,color=["Black","Orange",
"Magenta"],labels=["concentration","% drug effect"],legend=["E",
"E0","E_inf"],thickness=2,linestyle=[1,3,4]);
E0 := c
200
150
% drug effect 100
50
0
0
E
10
20
30
40
concentration
E0
50
E_inf
Notice that E0(c) very closely approximates the actual drug effect for drug concentrations roughly between
0 and 2, whereas E_inf(c) approximates the effect well for concentrations between about 14 and 50. But,
what about the region in between? What can we use to approximate the function near its peak, for example?
Let’s try to develop a quadratic approximation for E(c) around c = 4. Recall that this is centered on
matching the derivatives of E(c) to a quadratic function at our point of interest.
Step 1: Compute the first and second derivatives of E(c). We’ll save these as the functions Eprime(c) and
E2prime(c), respectively.
Eprime:=unapply(diff(E(c),c),c);
E2prime:=unapply(diff(Eprime(c),c),c);
14400 c3
4800
Eprime := c
3
c
c3
128
128
57600 c2
E2prime := c
2
86400 c5
(2.4)
2
3
c3 128
c3 128
Step 2: Use these derivatives to create a new quadratic function E_hat(c) that has the form E_hat(c,a) = E(a)
+E’(a)*(c−a) + 0.5*E’’(a)*(c−a)^2, where a is our reference point (e.g. 4). Because we possess wonderful
foresight, we’ll save E_hat(c) in the really general form above, so that we can evaluate it for any values of a
and c we want to. Since we have two unknows, we can use the same form for a function, but this time
instead of writing the usual c−>, we can put (c,a)−>. This tells Maple that there are two inputs to the
function. So, to find the quadratic approximation around c=4, we can siimply call E_hat(c,4), where 4 goes
in the place of a.
E_hat:=(c,a)−> E(a)+Eprime(a)*(c−a)+0.5*E2prime(a)*(c−a)^2;
E_hat(c,4);
E_hat := c, a
E a
Eprime a c a
0.5 E2prime a c a 2
100
6.250000000 c
4
2
(2.5)
Now we can plot all of our functions on the same graph to see how we did. We’ll save E(c) to its own plot
for c values between 0 and 50. Since E0(c) starts to break down around c=2, we’ll save its plot for c=0..2.
Similarly, we’ll save a plot of E_inf(c) for c=14..50. To fill in the space, we will see how well we can do by
plotting E_hat(c,4) from c=2 to c=14. Then we can use plots[display] to view our handiwork.
p1:=plot(E(c),c=0..50,0..100,color="Black", thickness=2,linestyle=
1): ## original
p2:=plot(E0(c),c=0..2,0..100,color="Orange",thickness=2,linestyle=
3): ## leading beh. at c=0
p3:=plot(E_inf(c),c=14..50,0..100,color="Magenta",thickness=2,
linestyle=4): ## leading beh. at infinity
p4:=plot(E_hat(c,4),c=2..14,0..100,color="LimeGreen",thickness=2,
linestyle=5): ## quadratic approx. at c=4
plots[display](p1,p2,p3,p4);
100
80
60
40
20
0
0
10
20
30
c
40
50
It looks like E_hat(c,4) didn’t cover as much ground as we would have liked. We could try to get a better
approximation by adding more derivative terms to E_hat(c,a), making it a higher degree polynomial.
Unfortunately, such an approximation alone wouldn’t span the interval we need it to. A second option is to
look at the behavior to the right of c=4. We can try to fit a very wide quadratic around perhaps c=11. Let’s
see what happens by redefining the plot p4 to cover only c=2..5, defining a new p5 for E_hat(c,10) from c=
5..14, and finally using plots[display] again.
p4:=plot(E_hat(c,4),c=2..5,0..100,color="LimeGreen",thickness=2,
linestyle=5): ## quadratic approx. at c=4
p5:=plot(E_hat(c,11),c=5..14,0..100,color="Cyan",thickness=2,
linestyle=5): ## quadratic approx at c=10
plots[display](p1,p2,p3,p4,p5);
100
80
60
40
20
0
0
10
20
30
40
50
c
While certainly better, it’s by no means perfect. We did, however, succeed in approximating different
pieces of a relatively complicated function (did you see those derivatives?) with much simpler forms. This
can make solving (and even evaluating) equations near where the approximations are really accurate much
easier (in a world without Maple).
Lab 10 Homework Problems
Please copy this entire section into a new worksheet, and save it as something
you’ll remember.
Your Full Name:
Your (registered) Lab Section:
Useful Tip #1: Read each problem carefully, and be sure to follow the directions specified for each
question!
Useful Tip #2: In case you missed it the first time, follow the directions specified for each question!!
Useful Tip #3: Here’s a little reminder to follow the directions specified for each question!!!
Useful Tip #4: Finally, don’t be afraid to troubleshoot! Does your answer make sense to you? If not,
explore why. If you’re still unsure, ask me.
Paper−saving tip: Make the size of your output graphs smaller to save paper when you print them. Please
ask me if you’re unsure of how to do this. (You can see how much paper you’d use beforehand by going to
File
Print Preview.)
The problem: Suppose you were transported to an alternate universe, against your will, in which
calculators and computers had no idea what the number e was. Not only that, but in order to get home, you
had to complete the task of computing the value of exp(0.075) to an accuracy of 8 decimal places. What
could you do to get home as quickly as possible? This assignment will walk you through the process of
creating Taylor polynomials to approximate exp(x) around x=0 to figure out the answer.
The solution: Recall that the formula for a Taylor polynomial of degree j around the point x=a is given by
Pj(x) = f(a) + fprime(a)*(x−a) + (f2prime(a)*(x−a)^2)/2 + ... + (fjprime(a)*(x−a)^j)/(j!).
The goal is to create Taylor polynomials for f(x) = exp(x) around x=0 up to degree 10 in order to
approximate the value of f(x) for some nearby x.
(1) You do not need Maple for this problem.
(a) Step 0: Calculate f(0).
(b) Step 1: Compute your derivatives. What’s the jth derivative of exp(x) for j=1 through j=10? (Hint:
There’s only one answer).
(c) Step 2: Evaluate your derivatives at a = 0. Given your answer to the previous question, what is fjprime
(0) for any j?
(d) Step 3: Modify the formula for Pj(x) given above to reflect your answers from Steps 1 and 2, and write
(or type) the simplified formula for the jth degree Taylor polynomial for exp(x) below. Remember to
replace any ’a’ with zero.
(2)(a) Using your formula from Step 3, define the function P1(x) to be the Taylor polynomial of degree 1.
Note: this means the highest power of x should be 1.
## first polynomial
(b) Do the same for degrees 2 through 10 (i.e. define P2(x) through P10(x)).
Suggestion: think about how to do this as concisely as possible, so that you don’t have to type each term for
every function.
## nine more polynomials
(3)(a) Plot exp(x), P2(x), P5(x) and P10(x) for x values between −0.2 and 0.2 and for y−axis values between
0.8 and 1.2.
Required:
[1] Specify a thickness of 2 for exp(x) only and 1 for all other curves.
[2] Specify a single color for all of your curves.
[3] Specify a different line style for each curve.
Note: These required elements should all appear within your plot command.
## plot
(b) What do you notice about your curves in the plot above?
(4)(a) Plot the same functions as in 3a, but this time for x values between −10 and 10 and for y−axis values
between −5 and 10.
Required:
[1] Specify a thickness of 2 for exp(x) only and 1 for all other curves.
[2] Specify a single color for all of your curves.
[3] Specify a different line style for each curve.
[4] Include a legend to distinguish between your curves.
Note: These required elements should all appear within your plot command.
## plot
(b) What happens to the Taylor polynomial approximation for values of x farther from 0?
(5)(a) Now for the moment of truth. Compute the value of each polynomial you defined above at x=0.075.
## compute the 10 approximate answers
(b) Assuming you were given the answer to begin with, compute exp(0.075).
## compute the actual answer
(c) Comparing the actual answer to your approximations, at which degree polynomial would you have
stopped to avoid unnecessary calculations (and to end your encounters in the alternate universe)? In other
words, which polynomial is the first to give an accuracy to 8 decimal places?
(6) Why does it make sense to choose a=0 as a reference point to approximate 0.075?
(7) What is the new thing we learned about defining functions in Maple today?
Congratulations! You’ve earned your trip home!
Download