• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Example: Gradient of a Gaussian (redirected from Gradient of a Gaussian)

Page history last edited by Joe Redish 6 years, 9 months ago

Class content I > The Main Question: Motion > Kinematics > Vectors

3.1.2.3.1

 

Prerequisites:

 

We defined the gradient as a vector derivative

 

where the curly d's remind us that the function depends on many variables and when we take each derivative, we have to not change the other variables while we are doing it.

 

Let's look at an example in 2D to see how this works mathematically. A simple important function of two variables that has non-trivial derivatives is the Gaussian:

Since the combination x2 + y2 = r2  is the square of the distance from the origin, the Gaussian function can be written

Since this is only a function of r, we expect it to be symmetric around the origin (only a function of the distance from 0, not the direction) and it is. Let's look at it in two views: a 3D graph showing the height z = f (x,y ) as a function of two variables on the left, and a contour plot (topographical map) looking at the graph from above on the right. In the topo map the lines of equal color marks lines of equal height (equal value of the function.

   

If we look at these two plots and think about their gradients as telling us how a ball would roll on the surface considered as a hill, we can see that we expect there to be no force at the top (it doesn't know way which way to roll), the force points down and away from the center, and gets smaller as we get farther away from the origin.

 

Let's see how this play out in the math. It's easiest to consider the Gaussian as a function of r and r as a function of x and y. We can then use the chain rule. Let's get the derivative first with respect to x. Since we are treating y as a constant, this is just the same as if we were doing calculus with only 1 variable.

Similarly, the derivative with respect to y will give -4yf. So our total result for the gradient is

Reading this equation, it says that the gradient of the Gaussian function, f, is just -2f times the vector r  from the origin to the point where we are considering the gradient. 

 

This tells us two things: (1) that the magnitude of the gradient of f is 2rf , (2) that the direction of the gradient is opposite to the vector to the position we are considering. What this means is made clear at the figure at the right. We are considering the gradient at the point (x,y). The vector to that point is r.  The gradient at (x,y) points back to the origin (the highest point) -- in the direction opposite to r.

 

The force associated with the gradient is the negative, of the gradient so it points in the same direction as r. 

 

 

The gradient of the Gaussian function, f, is a vector function of position; that is, it is a vector for every position r given by

For the forces associated with this gradient, we take the negative since the force associated with a PE will point "downhill."

 

This equation assigns a vector to each point in space. This kind of thing is called a vector field and will be very important when we start talking more about electric forces. One useful way to represent it is as a field diagram -- a diagram that attaches the vector to each point in space. For this case, the forces associated with a potential energy, f, looks something like the figure at the right.

Created with EquationExplorer by Kevin Mehall.

You ought to be able to match this with the diagrams at the top of the page and see how the forces downhill agree with your expectations, both from the shape of the hill and from the equation we calculated for the gradient.

 

Joe Redish 11/4/14

 

 

 

 

 

Comments (0)

You don't have permission to comment on this page.