Level Curves in Matlab

Similar documents
Examples: Find the domain and range of the function f(x, y) = 1 x y 2.

Discussion 8 Solution Thursday, February 10th. Consider the function f(x, y) := y 2 x 2.

Calculus 3 Exam 2 31 October 2017

Section 15.3 Partial Derivatives

Math 2411 Calc III Practice Exam 2

ANSWER KEY. (a) For each of the following partials derivatives, use the contour plot to decide whether they are positive, negative, or zero.

14.1 Functions of Several Variables

Similarly, the point marked in red below is a local minimum for the function, since there are no points nearby that are lower than it:

INTRODUCTION TO MATLAB by. Introduction to Matlab

Calculus I Handout: Curves and Surfaces in R 3. 1 Curves in R Curves in R 2 1 of 21

Math 5BI: Problem Set 1 Linearizing functions of several variables

Lecture 15. Global extrema and Lagrange multipliers. Dan Nichols MATH 233, Spring 2018 University of Massachusetts

18.3. Stationary Points. Introduction. Prerequisites. Learning Outcomes

GCSE (9-1) Grade 8/9 Transforming Graphs

MATH 105: Midterm #1 Practice Problems

Math 148 Exam III Practice Problems

Goals: To study constrained optimization; that is, the maximizing or minimizing of a function subject to a constraint (or side condition).

Multivariate Calculus

Chapter 5 Advanced Plotting

Solutions to the problems from Written assignment 2 Math 222 Winter 2015

11.2 LIMITS AND CONTINUITY

Maxima and Minima. Terminology note: Do not confuse the maximum f(a, b) (a number) with the point (a, b) where the maximum occurs.

CSCD 409 Scientific Programming. Module 6: Plotting (Chpt 5)

14.4. Tangent Planes. Tangent Planes. Tangent Planes. Tangent Planes. Partial Derivatives. Tangent Planes and Linear Approximations

MULTI-VARIABLE OPTIMIZATION NOTES. 1. Identifying Critical Points

Lecture 4 : Monday April 6th

Now we are going to introduce a new horizontal axis that we will call y, so that we have a 3-dimensional coordinate system (x, y, z).

WESI 205 Workbook. 1 Review. 2 Graphing in 3D

Homework Questions 2.5 LINEAR EXPRESSIONS AND EQUATIONS

Partial Differentiation 1 Introduction

Exam 2 Review Sheet. r(t) = x(t), y(t), z(t)

LECTURE 19 - LAGRANGE MULTIPLIERS

Level Curves, Partial Derivatives

MA Calculus III Exam 3 : Part I 25 November 2013

Review Sheet for Math 230, Midterm exam 2. Fall 2006

SYDE 112, LECTURE 34 & 35: Optimization on Restricted Domains and Lagrange Multipliers

Review guide for midterm 2 in Math 233 March 30, 2009

Math 2321 Review for Test 2 Fall 11

Section 2.3 Task List

11.7 Maximum and Minimum Values

Contents. An introduction to MATLAB for new and advanced users

Conic and Quadric Surface Lab page 4. NORTHEASTERN UNIVERSITY Department of Mathematics Fall 03 Conic Sections and Quadratic Surface Lab

4 The Cartesian Coordinate System- Pictures of Equations

Lesson 6.1 Linear Equation Review

Section 7.2 Logarithmic Functions

Lecture 19 - Partial Derivatives and Extrema of Functions of Two Variables

B) 0 C) 1 D) No limit. x2 + y2 4) A) 2 B) 0 C) 1 D) No limit. A) 1 B) 2 C) 0 D) No limit. 8xy 6) A) 1 B) 0 C) π D) -1

[f(t)] 2 + [g(t)] 2 + [h(t)] 2 dt. [f(u)] 2 + [g(u)] 2 + [h(u)] 2 du. The Fundamental Theorem of Calculus implies that s(t) is differentiable and

Optimization Exploration: The Inscribed Rectangle. Learning Objectives: Materials:

MATH Exam 2 Solutions November 16, 2015

THE DOMAIN AND RANGE OF A FUNCTION Basically, all functions do is convert inputs into outputs.

UNIT 2: FACTOR QUADRATIC EXPRESSIONS. By the end of this unit, I will be able to:

INTEGRATION OVER NON-RECTANGULAR REGIONS. Contents 1. A slightly more general form of Fubini s Theorem

4 to find the dimensions of the rectangle that have the maximum area. 2y A =?? f(x, y) = (2x)(2y) = 4xy

Section 5.2 Graphs of the Sine and Cosine Functions

Chapter 5 Advanced Plotting and Model Building

10 GRAPHING LINEAR EQUATIONS

EXPLORING POLAR COORDINATES WITH THE GEOMETER S SKETCHPAD

Contents. 1 Matlab basics How to start/exit Matlab Changing directory Matlab help... 2

Exam 2 Summary. 1. The domain of a function is the set of all possible inputes of the function and the range is the set of all outputs.

33. Riemann Summation over Rectangular Regions

ES 111 Mathematical Methods in the Earth Sciences Lecture Outline 6 - Tues 17th Oct 2017 Functions of Several Variables and Partial Derivatives

Computer Programming ECIV 2303 Chapter 5 Two-Dimensional Plots Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering

Math 259 Winter Recitation Handout 6: Limits in Two Dimensions

Math 32, October 22 & 27: Maxima & Minima

1. Measure angle in degrees and radians 2. Find coterminal angles 3. Determine the arc length of a circle

Plotting in MATLAB. Trevor Spiteri

Perry High School. Algebra 2: Week 9. Note: Don t forget to read the sections before or after we cover them. Also, don t forget the website.

Excel / Education. GCSE Mathematics. Paper 5B (Calculator) Higher Tier. Time: 2 hours. Turn over

Final Exam Review Problems. P 1. Find the critical points of f(x, y) = x 2 y + 2y 2 8xy + 11 and classify them.

Let s examine this situation further by preparing a scatter plot with our graphing calculator:

6.1 - Introduction to Periodic Functions

2.1 Partial Derivatives

Drexel-SDP GK-12 ACTIVITY

Sect 4.5 Inequalities Involving Quadratic Function

Chapter 3, Part 1: Intro to the Trigonometric Functions

DIFFERENTIAL EQUATIONS. A principal model of physical phenomena.

9/11/2017 Assignment Previewer

Math Lecture 2 Inverse Functions & Logarithms

Experiments #6. Convolution and Linear Time Invariant Systems

Aim #35.1: How do we graph using a table?

Test Yourself. 11. The angle in degrees between u and w. 12. A vector parallel to v, but of length 2.

5.1N Key Features of Rational Functions

1 Equations for the Breathing LED Indicator

Lab I - Direction fields and solution curves

Independence of Path and Conservative Vector Fields

Practice problems from old exams for math 233

Edexcel GCSE Mathematics Paper 3 (Non-Calculator) Higher Tier Specimen paper Time: 1 hour and 45 minutes

Practice problems from old exams for math 233

Chapter 16. Partial Derivatives

1 Graphs of Sine and Cosine

1.6. QUADRIC SURFACES 53. Figure 1.18: Parabola y = 2x 2. Figure 1.19: Parabola x = 2y 2

2. To receive credit on any problem, you must show work that explains how you obtained your answer or you must explain how you obtained your answer.

Section 3: Functions of several variables.

Mathematics 205 HWK 2 Solutions Section 12.4 p588. x\y 0 1 2

Lesson 11: Linear and Exponential Investigations

Chapter 6: Periodic Functions

Review Problems. Calculus IIIA: page 1 of??

Lesson 1b Linear Equations

14.2 Limits and Continuity

Transcription:

College of the Redwoods Mathematics Department Multivariable Calculus Level Curves in Matlab David Arnold Directory Table of Contents. Begin Article. Copyright c 999 darnold@northcoast.com Last Revision Date: May 4, 999 Version.00

Table of Contents. Introduction and Prerequisites. Level Sets and Contours.. Matlab s Contour Command.. Labeling the Contours.3. Choosing Particular Contours.4. Implicit Function Plotting.5. Homework Exercises

Section : Introduction and Prerequisites 3. Introduction and Prerequisites In this activity, Matlab is used to explore the level curve concept of functions mapping R into R. Some familiarity with Matlab s meshgrid command is required, as well as rudimentary knowledge of Matlab s element wise operators (.*,./,.^).. Level Sets and Contours Let s begin with a definition. Definition Let f : R R. The set {(x, y) :f(x, y) =c}, where c is an arbitrary constant, is called a level set of the function f. Consider the function f : R R defined by f(x, y) =x + y. The level sets of f are then defined by {(x, y) :f(x, y) =c} or { (x, y) :x + y = c } ()

Section : Level Sets and Contours 4 If you choose c =inequation, then the set of points { (x, y) :x + y = } () is a circle of radius, centered at the origin (See Figure ), and is called a level set of the function f. The usual practice is to sketch several level sets by selecting different values for the constant c. For example, if you let c =,, 3, 4, 5 in Equation, then the following level sets are obtained. { (x, y) :x + y = } { (x, y) :x + y = } { (x, y) :x + y =3 } { (x, y) :x + y =4 } { (x, y) :x + y =5 } Each of these level sets is a circle, centered at the origin, with radius,, 3,, and 5. Note that it is customary to label each level

Section : Level Sets and Contours 5 0 0 Figure : The level set f(x, y) =.

Section : Level Sets and Contours 6 0 0 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 Figure : Level curves for c =,, 3, 4, 5.

Section : Level Sets and Contours 7 curve with its c-value, as shown in Figure. The level sets pictured in Figure offer a wealth of visual information about the function f. For example, as you move away from the point (0, 0), located at the center of Figure, the function values increase. As you move toward the point (0, 0), the function values decrease. It is no coincidence that the level sets in Figure closely resemble a topographical map, where each contour represents a constant height. There are numerous applications where level curves can be very useful. For example, suppose that the function f(x, y) =x + y used to generate the level curves in Figure represents the temperature (in degrees Fahrenheit) at the position (x, y). Any point selected from the curve x +y = will have temperature F, points selected from the curve x + y = will have temperature F, and so on.

Section : Level Sets and Contours 8.. Matlab s Contour Command Matlab simplifies the process of constructing level curves, even for the most difficult of functions. Example Sketch several level curves of the function f : R R defined by f(x, y) = 3y x + y + (3) over the region {(x, y) : x, y } and label each level curve with its constant function value. Solution. First use the meshgrid command to create a grid of x and y-values on the given domain. Calculate the function value at each point and use Matlab s contour command to draw the level curves. The following commands should produce an image similar to that in Figure 3.

Section : Level Sets and Contours 9 >> [x,y]=meshgrid(-:.:); >> z=-3*y./(x.^+y.^+); >> contour(x,y,z) If you are not satisfied by the number of level curves produced, it is a simple matter to add more. The following command should produce 0 level curves, similar to those in Figure 4. >> contour(x,y,z,0).. Labeling the Contours It is a simple task to label each level curves with its constant function value. The following commands were used to produce the image in Figure 5. >> [c,h]=contour(x,y,z); >> clabel(c,h);

Section : Level Sets and Contours 0 0 0 Figure 3: Level curves of f(x, y) = 3y/(x + y +).

Section : Level Sets and Contours 0 0 Figure 4: Ten level curves.

Section : Level Sets and Contours 0 0.5 0.5 0 0 0 0.5 0.5 0.5 0.5 0 Figure 5: Labeling the level curves.

Section : Level Sets and Contours 3 Note: If you are unhappy with the placement of the labels, then you might want to try clabel(c,h, manual ) instead. This command will allow you to place the labels with your mouse..3. Choosing Particular Contours You might have noted by now that Matlab automatically decides on the optimum c-values when plotting the level curves f(x, y) =c. You can easily override this automatic selection and plot contours for particular c-values. For example, suppose that you want level curves for c =.5,.00, 0.75,...,.5. Recall that the Matlab code -.5:.5:.5 will produce this vector of c-values. The following command was used to create the image in Figure 6. >> [c,h]=contour(x,y,z,-.5:.5:.5); >> clabel(c,h) Note: Again, if you do not care for the crowded appearance of the labels in Figure 6, try the command clabel(c,h, manual ), which

Section : Level Sets and Contours 4.5.5 0.75 0 0.5 0.5 0.5 0.75.5 0.5 0.75 0.5 0.75 0.5 0 0 0.5 0.5 0.75 0.5 0.5 0.5 0.75.5.5 0 Figure 6: Specifying particular contours. 0.75

Section : Level Sets and Contours 5 will allow you to set the labels individually with the mouse..4. Implicit Function Plotting Often, an equation such as x 3 + y 3 =3xy (4) is difficult (or impossible) to solve for y in terms of x. However, you can use Matlab s contour command as an implicit function plotter, eliminating the need to explicitly solve the equation for y in terms of x before plotting. Begin by making one side of Equation 4 equal to zero. x 3 + y 3 3xy =0 (5) Next, define a function f : R Equation 5 now reads R by f(x, y) =x 3 + y 3 3xy. f(x, y) =0, (6)

Section : Level Sets and Contours 6 where f(x, y) =x 3 + y 3 3xy. Consequently,Equation 6 is the level curve f(x, y) = 0 of the function f(x, y) =x 3 +y 3 3xy. You can plot a single level curve of a function by using Matlab s contour command in the form contour(x,y,z,[c c]). The following commands should produce an image similar to that in Figure 7. Note how a finer mesh is used in this example to improve the accuracy of the plot. >> [x,y]=meshgrid(-:.05:); >> z=x.^3+y.^3-3*x.*y; >> contour(x,y,z,[0,0]).5. Homework Exercises. Consider the function defined by the equation f(x, y) = xye x y (a) Use Matlab s contour command to plot twenty (0) contours over the domain {(x, y) : x, y }.

Section : Level Sets and Contours 7 0 0 Figure 7: Plotting a single contour.

Section : Level Sets and Contours 8 (b) Use the form clabel(c,h, manual ) to selectively label several contours with the mouse. (c) Obtain a printout of your result.. Consider the function defined by the equation f(x, y) = xye x y (a) Use Matlab s contour3 command to plot twenty (0) contours over the domain {(x, y) : x, y }. Hint: Type help contour3 to obtain help on the contour3 command. (b) Turn off the grid with the command grid off. (c) Obtain a printout of your result. 3. Consider the function defined by the equation f(x, y) = xye x y

Section : Level Sets and Contours 9 (a) Use Matlab s meshc command to obtain a simultaneous plot of the surface and the level curves of the function over the domain {(x, y) : x, y }. Hint: Type help meshc to obtain help on the meshc command. (b) Remove hidden line removal with the command hidden off. (c) Obtain a printout of your result. 4. Sketch the graph of the famous knot curve whose points satisfy the equation (x ) = y (3 + y) Obtain a printout of your result.