MATH 241: MATLAB Problem Set - Curves and Surfaces, Assignments of Advanced Calculus

Problem set 2 for math 241, focusing on matlab implementation of calculus concepts. The problems involve plotting curves and surfaces, calculating speeds and curvatures, and identifying critical points and level curves.

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-74
koofers-user-74 🇺🇸

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
MATH 241
MATLAB Problem Set 2
Problems 2,3,4,5 are based on material in chapters 5 and 8 of the MATLAB
Companion.
Print out the plots of each part of the following problems to hand in. If you
wish to economize on the amount of paper, you may use the command subplot
(page 93 of the MATLAB Companion).
Make a short Mfile for each problem that contains all the commands that you
used to make your plots. Use the command diary and the command type to
print out the Mfile. See the end of Chapter 2 of the MATLAB Companion. It
is on my webpage at www.math.umd.edu/~jec. For each problem, hand in the
printout of the Mfile and attach the plots.
1. Let Cbe the curve parameterized by
r(t) = ((cos t)3,(sin t)3),0t2π.
This is an example of a piecewise smooth curve.
a) Plot the curve. Does it have cusps?
b) Calculate the speed kv(t)k=kr0(t)kby hand. Then graph it on the interval
[0,2π]. Where is the speed equal to zero? Does this agree with the values of t
where the plot in part a) has a cusp?
c) Calculate the curvature by hand. In two dimensions, the formula becomes
κ=|x00y0y00 x0|
kvk3.
For what values of tdoes κblow up? Is this what you expect from your graph in
part a)? Why?
2. Let
g(x, y) = 2e(x1)2(y1)2+ 1.8e5(x+1)23y2e2(x1)23(y+.5)2.
The formula is too long for an inline function, so it is best to write an Mfile, g.m,
for this function. Make it “array smart”.
a) Graph gover the same square Dused in problem 1. Here you should
construct the meshgrid as in Example 5.2 and the command surf.
b) To see the contours in the xy plane, use the contour command as in Example
5.5 with 20 contour lines. Use this contour plot to estimate the coordinates of the
the two peaks, the bottom of the valley, and the saddle point.
pf3

Partial preview of the text

Download MATH 241: MATLAB Problem Set - Curves and Surfaces and more Assignments Advanced Calculus in PDF only on Docsity!

MATH 241

MATLAB Problem Set 2

Problems 2,3,4,5 are based on material in chapters 5 and 8 of the MATLAB Companion. Print out the plots of each part of the following problems to hand in. If you wish to economize on the amount of paper, you may use the command subplot (page 93 of the MATLAB Companion). Make a short Mfile for each problem that contains all the commands that you used to make your plots. Use the command diary and the command type to print out the Mfile. See the end of Chapter 2 of the MATLAB Companion. It is on my webpage at www.math.umd.edu/~jec. For each problem, hand in the printout of the Mfile and attach the plots.

  1. Let C be the curve parameterized by

r(t) = ((cos t)^3 , (sin t)^3 ), 0 ≤ t ≤ 2 π.

This is an example of a piecewise smooth curve. a) Plot the curve. Does it have cusps? b) Calculate the speed ‖v(t)‖ = ‖r′(t)‖ by hand. Then graph it on the interval [0, 2 π]. Where is the speed equal to zero? Does this agree with the values of t where the plot in part a) has a cusp? c) Calculate the curvature by hand. In two dimensions, the formula becomes

κ =

|x′′y′^ − y′′x′| ‖v‖^3

For what values of t does κ blow up? Is this what you expect from your graph in part a)? Why?

  1. Let

g(x, y) = 2e−(x−1)

(^2) −(y−1) 2

    1. 8 e−5(x+1)

(^2) − 3 y 2 − e−2(x−1)

(^2) −3(y+.5) 2 .

The formula is too long for an inline function, so it is best to write an Mfile, g.m, for this function. Make it “array smart”. a) Graph g over the same square D used in problem 1. Here you should construct the meshgrid as in Example 5.2 and the command surf. b) To see the contours in the xy plane, use the contour command as in Example 5.5 with 20 contour lines. Use this contour plot to estimate the coordinates of the the two peaks, the bottom of the valley, and the saddle point.

  1. Write an inline function for the function

u(x, y) = (− 4 x^3 + 3x^2 + 1)(y − y^2 ).

Make sure it is “array smart”. The function u is the temperature at a point (x, y) in the unit square Q = { 0 ≤ x ≤ 1 , 0 ≤ y ≤ 1 }. The heat flux at each point is the negative of the gradient vector −∇u(x, y) = −[ux(x, y), uy(x, y)]. a) Verify by hand that ux(0, y) = 0 for 0 ≤ y ≤ 1 and that u = 0 on the other three edges of the square. This means that the left edge of the square is insulated, and that the temperature is held at zero on the other three edges. b) Put a 20 by 20 meshgrid on Q. Graph u over Q using the command surf(X,Y,u(X,Y)). Note where the temperature is greatest, and the appearance of the surface on the edge x = 0. c) Compute the gradient of u by hand. Write inline functions for ux and uy. Then enter the commands

U = u(X,Y); Ux = ux(X,Y); Uy = uy(X,Y); contour(X,Y,U,20) hold on quiver(X,Y,-Ux,-Uy)

The last command attaches arrows at each point of the meshgrid to represent the vector field of the heat flux. d) Use the plot of part c) to answer the following questions. What is the direction of the heat flux with respect to the level curves? Where is the hot spot, and which way is the heat flowing? What is the angle at which the level curves meet the edge x = 0? What is the direction of the heat flux at that edge of the square? How do you explain this physically? Why are the flux vectors perpendicular to the other edges?

  1. Let f (x, y) = x^4 − 2 x^2 − y^3 + 3y. This function has six critical points in the square D = {|x| ≤ 2 , |y| ≤ 2 }. Make an inline function for f that is “array smart”. a) Make a fine mesh over the square D, say 50 by 50. Then use the command contour(X,Y,f(X,Y),levels) where levels = linspace(-4,4, 21). Look at the contour map to locate the six critical points. On the printout of the contour map, indicate the location of each critical point, and indicate its nature.