Page 106 - A Guide to MATLAB for Beginners and Experienced Users
P. 106
Practice Set B: Calculus, Graphics, and Linear Algebra 87
√
2
(d) x x + 4 dx.
(e)
∞ e −x 2 dx.
−∞
4. Compute the following integrals numerically, using quad8 or quadl:
π sin x
(a) e dx.
0
√
1
3
(b) x + 1 dx.
0
∞ −x 2
(c) e dx. In this case, also approximate the error in the numerical
−∞
answer, by comparing withthe exact answer found in Problem 3.
5. Evaluate the following limits:
sin x
(a) lim x→0 .
x
1+cos x
(b) lim x→−π .
x+π
2 −x
(c) lim x→∞ x e .
1
(d) lim x→1 − .
x−1
(e) lim x→0 sin 1 .
+
x
6. Compute the following sums:
2
(a) n k .
k=1
k
(b) n k=0 r .
(c) ∞ x k . You may need the gamma function (x) =
∞ −t x−1 dt,
e t
k=0 k! 0
called gamma in MATLAB, which satisfies (k + 1) = k!.
(d) ∞ 1 2 .
k=−∞ (z−k)
7. Find the Taylor polynomial of the indicated order n at the indicated point
c for the following functions:
x
(a) f (x) = e , n = 7, c = 0.
(b) f (x) = sin x, n = 5 and 6, c = 0.
(c) f (x) = sin x, n = 6, c = 2.
(d) f (x) = tan x, n = 7, c = 0.
(e) f (x) = ln x, n = 5, c = 1.
(f) f (x) = erf(x), n = 9, c = 0.
8. Plot the following surfaces:
(a) z = sin x sin y for −3π ≤ x ≤ 3π and −3π ≤ y ≤ 3π.
2
2
2
2
(b) z = (x + y ) cos(x + y ) for −1 ≤ x ≤ 1 and −1 ≤ y ≤ 1.
9. Create a 17-frame movie, whose frames show filled red circles of radius
1/2 centered at the points 4 cos( jπ/8), 4 sin( jπ/8) , j = 0, 1,..., 16. Make
sure all the circles are drawn on the same set of axes, and that they look
like circles, not ellipses.
10. In this problem we use the backslash operator, or “left-matrix-divide” op-
erator introduced in the Solving Linear Systems section of Chapter 4.
(a) Use the backslash operator to solve the system of linear equations
in Problem 3 of Practice Set A.