



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Jim Lambers MAT 460/ Fall Semester 2009- Homework Assignment 1 Solution
푓 (푥) > ∣푘∣^3 + 2∣푘∣ + 푘 ≥ ∣푘∣^3 + ∣푘∣ = ∣푘∣(∣푘∣^2 + 1) ≥ 0.
Similarly, if 푥 < −∣푘∣, then
푓 (푥) < −∣푘∣^3 − 2 ∣푘∣ + 푘 ≤ −∣푘∣^3 − ∣푘∣ = −∣푘∣(∣푘∣^2 + 1) ≤ 0.
Therefore, by the Intermediate Value Theorem, 푓 (푥) = 0 for some 푥 ∈ (−∣푘∣, ∣푘∣). Because 푓 ′(푥) = 3푥^2 + 2 > 0, the contrapositive of Rolle’s Theorem applies. Since 푓 ′(푥) ∕= 0 for all 푥, we can conclude that there is no interval [푎, 푏] such that 푓 (푎) = 푓 (푏), for if there were, then there would exist a point 푐 ∈ [푎, 푏] such that 푓 ′(푐) = 0, which is a contradiction. Since 푓 (푥) never assumes the same value more than once, and it assumes the value zero at least once, it follows that 푓 (푥) = 0 for exactly one value of 푥.
(a) Use 푃 2 (0.5) to approximate 푓 (0.5). Find an upper bound on the error ∣푓 (0.5) − 푃 2 (0.5)∣ using the error formula, and compare it to the actual error. Solution We have
푓 ′(푥) = 푒푥(cos 푥 − sin 푥), 푓 ′′(푥) = 푒푥(− sin 푥 − cos 푥) + 푒푥(cos 푥 − sin 푥) = − 2 푒푥^ sin 푥 푓 ′′′(푥) = − 2 푒푥(cos 푥 + sin 푥).
Therefore, 푓 (0) = 1, 푓 ′(0) = 1, 푓 ′′(0) = 0,
which yields
푃 2 (푥) = 푓 (0) + 푓 ′(0)(푥 − 0) +
It follows that 푃 2 (0.5) = 1.5, and therefore ∣푓 (0.5) − 푃 2 (0.5)∣ = ∣ 1. 446889 − 1. 5 ∣ = 0. 05311. The error formula is given by
푅 2 (푥) = − 2 푒휉(푥)(cos 휉(푥) + sin 휉(푥)) 6
where 휉(푥) lies between 0 and 푥. To estimate 푅 2 (0.5), we must determine the largest value, in magnitude, of 푓 ′′′(푥) on the interval [0, 0 .5]. We have 푓 (4)(푥) = − 2 푒푥(cos 푥 + sin 푥) − 2 푒푥(cos 푥 − sin 푥) = − 4 푒푥^ cos 푥. Since this derivative is always negative on [0, 0 .5], it follows that 푓 ′′′(푥) is decreasing on this interval, and since 푓 ′′′(푥) is also negative on this interval, we can conclude that its largest value is assumed 푥 = 0.5, which is 푓 ′′′(0.5) = − 4. 4747. Therefore, we have
∣푅 2 (푥)∣ ≤
(b) Find a bound for the error ∣푓 (푥) − 푃 2 (푥)∣ in using 푃 2 (푥) to approximate 푓 (푥) on the interval [0, 1]. Solution The error is given by ∣푅 2 (푥)∣, so we must find a bound for this expression on [0, 1], just as we bounded it on [0, 0 .5] in part (a). As before, 푓 (4)(푥) < 0 on [0, 1], so 푓 ′′′(푥) is decreasing on this interval, and since it is also negative on this interval, it follows that its largest value, in magnitude, is assumed at 푓 ′′′(1) = − 7. 512. Therefore, on [0, 1], ∣푅 2 (푥)∣ ≤
(c) Approximate
0 푓^ (푥)^ 푑푥^ using^
Solution We have Z (^1)
0
0
1
0 ≈ 1. 5.
% cos, -sin, -cos, sin, etc. if r==0 | r==3, der=sq2; else der=-sq2; end % compute the next term of the Taylor polynomial y=y+derdx/fac; % update dx and fac. using the factorial function % or computing (x-pi/4)ˆi would be wasteful! dx=dx(x-pi4); fac=fac*(i+1); end
In the following MATLAB session, we use this function to approximate cos 42∘.
% convert 42 degrees to radians deg42=42*pi/
deg42 =
% compute the exact answer exact=cos(deg42)
exact =
% compute the the value of the nth polynomial for % increasing n until enough accuracy is achieved n=0; while n==0 | abs(exact-y)>1e-6, y=hw1prob1115(deg42,n) n=n+1;
end
y =
y =
y =
y =
Modify your algorithm from Exercise 15 so that it computes an approximation to 푒푥^ using 푃푛(푥) with center 푥 0 = 0. Find a value of 푛 necessary for 푃푛(푥) to approximate 푒푥^ to within 10 −^6 on [0, 0 .5]. Using MATLAB, show that with this value of 푛, your algorithm approximates 푒푥^ to this degree of accuracy at 푥 = 0.25. Solution The following function computes the approximation 푃푛(푥) for given 푥 and 푛.
function y=hw1prob1119(x,n) % initialize the output value y y=0; % dx will store xˆi dx=1; % fac will store i! (factorial) fac=1; for i=0:n, % compute the next term of the Taylor polynomial y=y+dx/fac; % update dx and fac. using the factorial function % or computing xˆi would be wasteful! dx=dxx; fac=fac(i+1); end
whenever 0 < ∣푥 − 푐∣ < 훿, and 푥 ∈ [푎, 푏]. For each 휖, we can choose 훿 = 휖/퐿. Then, if 0 < ∣푥 − 푐∣ < 훿, we have
This shows that 푓 is continuous at 푐, and since 푐 ∈ [푎, 푏] is arbitrary, we conclude that 푓 is continuous on [푎, 푏].
(b) Show that if 푓 has a derivative that is bounded on [푎, 푏] by 퐿, then 푓 satisfies a Lipschitz condition with Lipschitz constant 퐿 on [푎, 푏]. Solution If ∣푓 ′(푥)∣ ≤ 퐿 on [푎, 푏], it follows that for any two points 푥, 푦 ∈ [푎, 푏], where 푥 ∕= 푦, (^) ∣ ∣ ∣∣^ 푓^ (푥)^ −^ 푓^ (푦) 푥 − 푦
because if this was not the case, then by the Mean Value Theorem, we would have ∣푓 ′(푐)∣ > 퐿 for some 푐 between 푥 and 푦, which is a contradiction. Multiplying through the preceding inequality by ∣푥 − 푦∣ yields the inequality
∣푓 (푥) − 푓 (푦)∣ ≤ 퐿∣푥 − 푦∣,
and since this holds for all 푥, 푦 ∈ [푎, 푏], we conclude that 푓 satisifes a Lipschitz condition with Lipschitz constant 퐿 on [푎, 푏]. (c) Give an example of a function that is continuous on a closed interval but does not satisfy a Lipschitz condition on the interval. Hint: what can be said about the derivative of such a function? Solution One example is 푓 (푥) = 푥^1 /^3 on the interval [− 1 , 1]. It is continuous on this interval, but its derivative becomes infinite at 푥 = 0, so it cannot satisfy a Lipschitz condition on [− 1 , 1] for any Lipschitz constant 퐿.