Difference between revisions of "Gradients and Directional Derivatives"
(27 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
|Image=Steepestdescent.gif | |Image=Steepestdescent.gif | ||
|ImageIntro=This image shows gradient [[Vector|vectors]] at different points on a contour map. These vectors show the paths of steepest descent at different points on the landscape. | |ImageIntro=This image shows gradient [[Vector|vectors]] at different points on a contour map. These vectors show the paths of steepest descent at different points on the landscape. | ||
− | |ImageDescElem=[[Image:Contour3.JPG|left|thumb|Graph and contour map of a function: Click to enlarge]] | + | |ImageDescElem=*Contour Maps and How they Relate the Gradients and Directional Derivatives [[Image:Contour3.JPG|left|thumb|Graph and contour map of a function: Click to enlarge]] |
− | A '''contour map''' utilizes the concept of '''level sets'''. A level set is the set of all points generated when a function is | + | A '''contour map''' utilizes the concept of '''level sets'''. A level set is the set of all points generated when a function is set equal to a constant. For example, one level set of the function |
− | + | <math> z = x^2 -y^2 </math> is | |
− | + | <math> 3=x^2-y^2 </math>. | |
+ | Setting a function from two variables to one variable equal to a constant in this way yields a '''contour curve'''. These curves are curves with constant z-component. If we use such a function to represent a landscape with the z-axis for altitude, then a contour curve shows constant height. | ||
− | + | A contour map is simply a collection of contour curves, each with the given function set equal to a different constant, meaning each curve represents a different constant height. Most importantly, it "squishes down" our three dimensional surface to give a better view of the entire perimeter of a space (a mountain for example) | |
− | The gradient | + | ===Gradients=== |
+ | Now suppose instead of seeking curves of constant height, we wish to find directions along which height changes most rapidly. This can now be done easily because we have projected "flattened down" the surface to the x-y plane in the contour map. Intuitively, we travel perpendicular to contour curves, since even partially traveling along contour curves would involve traveling along a level set. This page's main image shows a number of vectors perpendicular to contours, meaning they represent the most rapid change of height from the point at the tail of the vector. If the image represents mountains, then the vectors are actually pointing in the direction of steepest ''descent'', and are thus the negatives of the gradient vectors, which by definition always point in the direction of steepest ''ascent''. | ||
+ | ====Mathematical interpretations of Gradients==== | ||
+ | ====Relation to First Year Calculus==== | ||
+ | ===Directional Derivatives=== | ||
+ | ====Mathematical Interpretations of Directional Derivatives==== | ||
+ | |||
+ | |ImageDesc=The '''gradient''' is a useful idea for finding the path of steepest descent or ascent. For a scalar function f with two input variables, such as a function that gives height in terms of horizontal position, the gradient vector is defined in terms of [[Partial derivative| partial derivatives]]: | ||
+ | <math> \nabla f(\vec{x}) = (\partial{f}/\partial{x} , \partial{f}/\partial{y}) </math>. | ||
+ | |||
+ | Intuitively, this definition means that if our function has a high rate of change in a certain x-y direction, the gradient vector will have a large component in that direction, as shown in the directional derivative section. Note that the gradient can readily be extended to handle more than two input variables, by simply having the partial derivatives of each subsequent variable in each consecutive component. | ||
+ | |||
+ | Thus in this context the gradient function has an input of position, and an output of vectors. Each vector points in the direction of steepest ascent from the point the vector originates, with the vector's magnitude corresponding to the rate of ascent one would experience if one followed the vector. Traveling along gradient vectors in the opposite direction gives a path of steepest descent, as in this page's main image. | ||
So to change height most rapidly, we travel along gradient vectors, and to remain at the same height, we follow a level set. We can also analyze intermediate cases: given a direction of travel, how will our height change? | So to change height most rapidly, we travel along gradient vectors, and to remain at the same height, we follow a level set. We can also analyze intermediate cases: given a direction of travel, how will our height change? | ||
Line 19: | Line 32: | ||
===Directional Derivatives=== | ===Directional Derivatives=== | ||
− | The concept of directional derivative is useful for finding the rate of height change along any path. To do so, we simply take the unit vector in the direction of the path | + | The concept of directional derivative is useful for finding the rate of height change along any path. To do so, we simply take the dot product of the unit vector in the direction of the path with the gradient vector. |
Rate of height change along a path <math> \vec{v} </math> is <math> \nabla f \cdot \frac{\vec{v}}{\mid\vec{v}\mid}</math> | Rate of height change along a path <math> \vec{v} </math> is <math> \nabla f \cdot \frac{\vec{v}}{\mid\vec{v}\mid}</math> | ||
Line 25: | Line 38: | ||
By nature of the dot project, this rate is maximized when we travel along the gradient, and is minimized to zero when we travel perpendicular to the gradient, along a level set. | By nature of the dot project, this rate is maximized when we travel along the gradient, and is minimized to zero when we travel perpendicular to the gradient, along a level set. | ||
− | [[Image:Direcanimation.gif|thumb|left|400px|For a level set (blue), the magnitude of the directional derivative (black) is shown. It is the component of the gradient (purple) in the direction of the path (red).]] | + | [[Image:Direcanimation.gif|thumb|left|400px|For a level set (blue), the magnitude of the directional derivative (black) is shown. It is the component of the gradient (purple) in the direction of the path (red). Note that the directional derivative is in fact a scalar; the '''length''' of the black arrow here is equal to the directional derivative.]] |
− | [[Image:3d direcderiv2.JPG|thumb|center|320px|Directional derivative of a surface, which is the level set of a | + | [[Image:3d direcderiv2.JPG|thumb|center|320px|Directional derivative of a surface, which is the level set of a function from <math>R^3 \rightarrow R </math>. Gradient vector is blue, direction of path is purple, and the magnitude of the directional derivative is green. Again, the directional derivative is in fact a scalar, with the '''length''' of the green arrow here equal to the directional derivative.]] |
+ | |||
+ | {{-}} | ||
+ | ===Examples=== | ||
+ | [[Image:Levelset4.PNG|right|thumb|600px|Image for Example 1: level set of the field is purple gradient is red, and direction of the path is green]] | ||
+ | :*'''Example 1:''' Given the field <math> f(\vec{x}) = 3x^2 +2yx -yz^3 </math>, the gradient at any point is | ||
+ | |||
+ | :<math> \nabla f(\vec{x}) = (\partial{f}/\partial{x} , \partial{f}/\partial{y}, \partial{f}/\partial{z}) </math> | ||
+ | :<math> = (6x+2y, 2x-z^3, -3yz^2) </math> | ||
+ | |||
+ | |||
+ | :The gradient at the point <math> (1,2,0) </math> is: | ||
+ | |||
+ | :<math> (10, 2, 0) </math> | ||
+ | |||
+ | :The directional derivative from this point in the direction of the vector <math> (0,1,0)</math> is | ||
+ | :<math> (10, 2, 0) \cdot (0, 1, 0) = 0 + 2 + 0 = 2 </math> | ||
+ | |||
+ | {{-}} | ||
+ | [[Image:Levelset5.PNG|thumb|600px|Image for Example 2: Level set of the function is purple, gradient is red, and direction of path is green ]] | ||
+ | :*'''Example 2''': Given the field <math> f(\vec{x}) = sin(xy) +xyz + e^{yz} </math>, the gradient at any point is | ||
+ | |||
+ | :<math> \nabla f(\vec{x}) = (\partial{f}/\partial{x} , \partial{f}/\partial{y}, \partial{f}/\partial{z}) </math> | ||
+ | :<math> = (ycos(xy) +yz, xcos(xy) +xz +ze^{yz}, xy + ye^{yz} )</math> | ||
+ | |||
+ | :The gradient at the point <math> (0, 1, 5) </math> is: | ||
+ | :<math> (1+5,0+0+5e^5,0+e^5) = (6,5e^5,e^5) </math> | ||
+ | :The directional derivative in the direction of the vector <math> (0, 0, 1) </math> is | ||
+ | :<math> (6,5e^5,e^5) \cdot (0,0,1) = e^5 </math> | ||
+ | |other=Some Multivariable Calculus | ||
|AuthorName=Golden Software | |AuthorName=Golden Software | ||
|SiteURL=http://www.innovativegis.com/basis/Courses/GMcourse09/Syllabus/1stClass_reading/About%20Surfer/surfer.html | |SiteURL=http://www.innovativegis.com/basis/Courses/GMcourse09/Syllabus/1stClass_reading/About%20Surfer/surfer.html | ||
Line 34: | Line 76: | ||
|InProgress=No | |InProgress=No | ||
}} | }} | ||
+ | ===Gradients=== |
Latest revision as of 14:26, 28 May 2013
Gradients on a Contour Map |
---|
Gradients on a Contour Map
- This image shows gradient vectors at different points on a contour map. These vectors show the paths of steepest descent at different points on the landscape.
Contents
Basic Description
*Contour Maps and How they Relate the Gradients and Directional Derivatives
A contour map utilizes the concept of level sets. A level set is the set of all points generated when a function is set equal to a constant. For example, one level set of the function
is
.
Setting a function from two variables to one variable equal to a constant in this way yields a contour curve. These curves are curves with constant z-component. If we use such a function to represent a landscape with the z-axis for altitude, then a contour curve shows constant height.
A contour map is simply a collection of contour curves, each with the given function set equal to a different constant, meaning each curve represents a different constant height. Most importantly, it "squishes down" our three dimensional surface to give a better view of the entire perimeter of a space (a mountain for example)
Gradients
Now suppose instead of seeking curves of constant height, we wish to find directions along which height changes most rapidly. This can now be done easily because we have projected "flattened down" the surface to the x-y plane in the contour map. Intuitively, we travel perpendicular to contour curves, since even partially traveling along contour curves would involve traveling along a level set. This page's main image shows a number of vectors perpendicular to contours, meaning they represent the most rapid change of height from the point at the tail of the vector. If the image represents mountains, then the vectors are actually pointing in the direction of steepest descent, and are thus the negatives of the gradient vectors, which by definition always point in the direction of steepest ascent.
Mathematical interpretations of Gradients
Relation to First Year Calculus
Directional Derivatives
====Mathematical Interpretations of Directional Derivatives====
A More Mathematical Explanation
- Note: understanding of this explanation requires: *Some Multivariable Calculus
The gradient is a useful idea for finding the path of steepest descent or ascent. For a scalar [...]
The gradient is a useful idea for finding the path of steepest descent or ascent. For a scalar function f with two input variables, such as a function that gives height in terms of horizontal position, the gradient vector is defined in terms of partial derivatives: .
Intuitively, this definition means that if our function has a high rate of change in a certain x-y direction, the gradient vector will have a large component in that direction, as shown in the directional derivative section. Note that the gradient can readily be extended to handle more than two input variables, by simply having the partial derivatives of each subsequent variable in each consecutive component.
Thus in this context the gradient function has an input of position, and an output of vectors. Each vector points in the direction of steepest ascent from the point the vector originates, with the vector's magnitude corresponding to the rate of ascent one would experience if one followed the vector. Traveling along gradient vectors in the opposite direction gives a path of steepest descent, as in this page's main image.
So to change height most rapidly, we travel along gradient vectors, and to remain at the same height, we follow a level set. We can also analyze intermediate cases: given a direction of travel, how will our height change?
Directional Derivatives
The concept of directional derivative is useful for finding the rate of height change along any path. To do so, we simply take the dot product of the unit vector in the direction of the path with the gradient vector.
Rate of height change along a path is
By nature of the dot project, this rate is maximized when we travel along the gradient, and is minimized to zero when we travel perpendicular to the gradient, along a level set.
Examples
- Example 1: Given the field , the gradient at any point is
- The gradient at the point is:
- The directional derivative from this point in the direction of the vector is
- Example 2: Given the field , the gradient at any point is
- The gradient at the point is:
- The directional derivative in the direction of the vector is
Teaching Materials
- There are currently no teaching materials for this page. Add teaching materials.
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.
[[Description::This image shows gradient vectors at different points on a contour map. These vectors show the paths of steepest descent at different points on the landscape.|]]