The document outlines a lab exercise on numerical optimization involving three tasks related to graphing functions and their properties in Python. It includes instructions for plotting a function, calculating gradients, and creating tangent plane approximations over specified intervals and step sizes. The tasks require generating contour curves and gradient vector fields based on the given mathematical functions.
The document outlines a lab exercise on numerical optimization involving three tasks related to graphing functions and their properties in Python. It includes instructions for plotting a function, calculating gradients, and creating tangent plane approximations over specified intervals and step sizes. The tasks require generating contour curves and gradient vector fields based on the given mathematical functions.
The document outlines a lab exercise on numerical optimization involving three tasks related to graphing functions and their properties in Python. It includes instructions for plotting a function, calculating gradients, and creating tangent plane approximations over specified intervals and step sizes. The tasks require generating contour curves and gradient vector fields based on the given mathematical functions.
The document outlines a lab exercise on numerical optimization involving three tasks related to graphing functions and their properties in Python. It includes instructions for plotting a function, calculating gradients, and creating tangent plane approximations over specified intervals and step sizes. The tasks require generating contour curves and gradient vector fields based on the given mathematical functions.
1. Let f (x, y) = 10x2 + y 2 . Graph the function z = f (x, y) in Python
over a rectangle in x, y plane −1 ≤ x ≤ 1, 0 ≤ y ≤ 4 with a step size of △x = △y = 0.4, i.e, x-axis is divided into 5 equal subintervals and y-axis is divided into 10 equal subintervals. Then label the axes. Draw horizontal planes at heights z = 5, 10, 15 which intersects the graph z = f (x, y) to obtain the contour curves. The curve of intersection, projected down the x, y plane is the label curve f (x, y) = c where c = 5, 10, 15. Plot the level curve. (Note that if the rectangle is a ≤ x ≤ b, c ≤ y ≤ d then the step size △x = (b−a) n and △y = (d−c)m divides x-axis into n equal grid points and y-axis into m equal grid points respectively. In the above exercise n = 5 and m = 10.) 3 2. Let f (x, y) = xy − x3 . Then find ▽f . Graph the gradient vector field and the label curves of f over the square [−2, 2] × [−2, 2]. So choose the step size △x = △y = 0.5 in x-axis and y-axis. Intersect the curve 3 f (x, y) = xy − x3 by planes at height z = −5 to z = 5 with step size △z = 0.5 to find the contour curves and project onto the xy-plane to get label curve. Then plot the gradient vectors(or arrows), at each label curve with a distance of 0.2 apart.
3. Plot the graph f (x, y) = (1 − y 2 ) cos x over the square {−1 ≤ x, y ≤ 1}
with a step size △x = △y = 0.5. Plot the tangent plane approximation to f (x, y) = (1 − y 2 ) cos x at the point (x0 , y0 ) = (.2, −.4) over the smaller square {|x − .2|, |y + .4| ≤ .5}. The equation of tangent plane to z = f (x, y) at (x0 , y0 ) is z = L(x, y) = f (x0 , y0 ) + fx (x0 , y0 )(x − x0 ) + fy (x0 , y0 )(y − y0 ).