1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding Point where Gradient is the Greatest

  1. May 30, 2012 #1
    I have the function:
    f(x,y)= x*(y^2)*e^-((x^2+y^2)/4)
    I am not sure how to find the point where the gradient is the greatest.
    The gradient I found after taking the partials is:
    partial with respect to x: e^(-(x^2+y^2)/4)*((y^2)-.5(x^2)(y^2))
    partial with respect to y:e^(-(x^2+y^2)/4)*(2yx-.5x(y^3))
    What do I do next?
    (I have also found min/max points for this function)
     
  2. jcsd
  3. May 31, 2012 #2
    If you are trying to maximize the length of the gradient over the region, you might want to try squaring the gradient, so that it is a map from the plane to the real numbers, and use methods you have on that. (The gradient is longest where it's square is longest.)
     
  4. May 31, 2012 #3

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Hello mariya259. Welcome to PF !

    You sure are having fun with this function, aren't you ?

    Added in Edit:

    It is easier to work with the square of the magnitude of the gradient, rather than with the magnitude of the gradient itself.

    Get that by summing the squares of the two components which you have found.

    It sure involves some messy algebra !
     
    Last edited: May 31, 2012
  5. May 31, 2012 #4
    Do you mean taking the square root of each of the partials squared to find the maginitude:
    sqrt((e^(-(x^2+y^2)/4)*((y^2)-.5(x^2)(y^2)))^2 + (e^(-(x^2+y^2)/4)*(2yx-.5x(y^3)))^2) ?
     
  6. May 31, 2012 #5
    You don't want to maximize, that, it'll be unnecessarily computationally complicated. If you square it, looking for critical points won't be as messy.
     
  7. May 31, 2012 #6
    So only this part is what I need to do?
    e^(-(x^2+y^2)/4)*((y^2)-.5(x^2)(y^2)))^2 + (e^(-(x^2+y^2)/4)*(2yx-.5x(y^3)))^2
     
  8. May 31, 2012 #7
    Yes. Maximize the square of the gradient, to find the point where the gradient is longest.
     
  9. May 31, 2012 #8
    I took the sum of squares. From what I understand now I need to set it equal to 0 and solve for critical points?
     
  10. May 31, 2012 #9

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    No. You need to find the gradient of your new function (which is the square of the length of the gradient of the old function), then set this new gradient to zero. After all, is that not what you do when you want to maximize something?

    RGV
     
  11. May 31, 2012 #10

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    As algebrat said, if you work with the square of this, life will be easier. The maximum will occur in the same location for both this function and its square.

    You can factor out a common factor to simplify matters a bit.

    The square of the gradient as you gave it, which I think is correct, is:

    [itex]\displaystyle \left(e^{-(x^2+y^2)/4}\ ((y^2)-.5(x^2)(y^2))\right)^2 + \left(e^{-(x^2+y^2)/4}\ (2yx-.5x(y^3))\right)^2
    =\left(e^{-(x^2+y^2)/4}\right)^2\left(((y^2)-.5(x^2)(y^2))^2+(2yx-.5x(y^3))^2\right)[/itex]
    [itex]\displaystyle =e^{-(x^2+y^2)/2}\left(16 x^2 y^2+4 y^4-12 x^2 y^4+x^4 y^4+x^2 y^6\right)/4[/itex]​

    That's still pretty messy.

    It turns out that the gradient is maximum where you might expect --- midway between neighboring min & max .
     
  12. May 31, 2012 #11
    Alright. To find the partials and critical points can I just use the function with the sum of squares or do I need to take the function of the square root(sum of squares)?
     
  13. May 31, 2012 #12

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    This question was already answered. Anyway, instead of asking, just DO IT. If you do it both ways and compare the work involved, you will soon see which method is better. A good way to learn is to try thing yourself.

    RGV
     
  14. May 31, 2012 #13
    I understand you can use sum of squares instead of the sqrt of everything, I don't understand why you can do that. Wouldn't the square root change the answer of where the maximum is?
     
  15. May 31, 2012 #14

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Below is a graph of your function as given by WolframAlpha.
    attachment.php?attachmentid=47872&stc=1&d=1338490009.gif

    Below is a graph of the square ot the gradient you gave as graphed by WolframAlpha with relative maxima indicated in red.
    attachment.php?attachmentid=47877&stc=1&d=1338490365.gif
     

    Attached Files:

  16. May 31, 2012 #15

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    No.

    If a > b ≥ 0, then a2 > b2. Right ?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook