Jump to content
  • Advertisement
Sign in to follow this  
Deliverance

Partial derivatives of f(x,y)=z

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a height map that can be viewed as a function with two variables. I know every value of f(x,y) where 0<=x<=some max value and 0<=y<=some max value. How do i calculate(or approximate) the value of the partial derivatives of f at the point x,y? How do these derivatives look like?

Share this post


Link to post
Share on other sites
Advertisement
If you take the height values above and below your point (y - 1) & (y + 1), and determine dy for (y - 1)->(y) and (y) ->(y + 1), and average them, that's an approximation for your partial derivative with respect to y. Repeat for x.

You can omit one of the data points for less accuracy but more speed (eg: just do (y-1)->(y), and skip the second one and the average).

Share this post


Link to post
Share on other sites
Quote:
Original post by Numsgil
If you take the height values above and below your point (y - 1) & (y + 1), and determine dy for (y - 1)->(y) and (y) ->(y + 1), and average them, that's an approximation for your partial derivative with respect to y. Repeat for x.

You can omit one of the data points for less accuracy but more speed (eg: just do (y-1)->(y), and skip the second one and the average).


How did you figure out this approximation, what's the theory behind it?

Share this post


Link to post
Share on other sites
Well what you're calculating is the partial derivatives with respect to a particular variable...this case x and y. The partial derivative at any particular point would be the slope at that point, with the slope being the change in f as you change x or y. or in other words (f(xn, y) - f(xn-1, y))/(xn - xn-1). If xn is equal to xn-1 + 1, then the denominator is one and you can just evaluate the numerator. This gives you the partial derivative for the point in between xn and xn-1. If you calculate twice with xn-1 and xn+1, then you approximate the partial for xn.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!