1. Not finding help here? Sign up for a free 30min 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 the maximum value of a function

  1. Dec 4, 2015 #1
    1. The problem statement, all variables and given/known data

    Find the extremizing (maximum) value of the function f(x) = sin x / x using Newton's 1D method.

    2. Relevant equations

    upload_2015-12-4_16-13-34.png



    3. The attempt at a solution

    I know the maximum point in this equation is (0, 1). When I differentiated the equation twice and used the formula above, I managed to get a converging value of x at 4.49 radians and my corresponding value of f(x) is -0.217. I checked this using wolframalpha as well, and the converging value is 4.49 radians also. I'm sure I didn't make any silly algebraic errors, so what could be wrong here?
     
  2. jcsd
  3. Dec 4, 2015 #2

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    1 Check the formula. It doesn't make sense to me to bring in a second derivative !

    2 Where did you start ? Show what you did in more detail. You and I are not interested in the answer, we want the correct path to find it !

    -- :smile:
     
    Last edited: Dec 4, 2015
  4. Dec 4, 2015 #3
    I think the formula should be right. My teacher derived it from the Taylor Series, but I don't have my notes right now so I can't show that.

    It would take a while to type my working in LaTeX so I just took pictures of what I did. Just simple differentiation twice and then simplification. Then I took the initial value of x as 3 radians, and then kept iterating. Converged at ~4.49 radians.
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      61.6 KB
      Views:
      65
    • 2.jpg
      2.jpg
      File size:
      62.5 KB
      Views:
      62
  5. Dec 4, 2015 #4

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Well, the formula in the OP is not Newton's Method, which is why your results are incorrect. :frown:

    The correct formula is ##x_{new} = x_{old} - \frac{f(x)}{f'(x)}##

    https://en.wikipedia.org/wiki/Newton's_method
     
  6. Dec 4, 2015 #5
    I thought that method was for root finding? I am finding the maximum value of a function. Unless my concepts are wrong here..
     
  7. Dec 4, 2015 #6

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    99ca3ee7752a4df7bf1c4bbb7c963595.png (##\leftarrow##clickable link) is what they say in general. Makes much more sense if you look at it.
    Nice picture too: here
     
  8. Dec 4, 2015 #7

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    You're right. Late nite. Scratch that post.
     
  9. Dec 4, 2015 #8
    OK I got it. But please correct me if I am wrong:

    upload_2015-12-4_16-56-45.png

    The formula you posted will give me the red circled values (function when x = 0), and the one I posted gives me the green value (converging value of x)? Just let me know if I'm wrong then I'll look up a book again. :wideeyed:
     

    Attached Files:

  10. Dec 4, 2015 #9

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    If you plot y = sin(x) / x with WA, you'll see that this function oscillates quite a bit when x > 0. Your initial guess for x, whatever it was, has led the Newton's method to locate one of the relative minimas, which happens to be located at x ≈ 4.49 rad.

    You may have to try different starting points to see what pops out of the Newton's method for this function, since there are a lot of relative extremums, but only one global maximum point at x = 0.
     
  11. Dec 4, 2015 #10
    Interesting. I just realised that now looking at the plot again. Is there no way of figuring out where the global maximum will approximately be beforehand? Or do you have to just keep guessing?
     
  12. Dec 4, 2015 #11

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Woops, me 2 !! o:) o:)
     
  13. Dec 4, 2015 #12

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Your formula is correct, since you are trying to solve the equation ##f^{\prime}(x) = 0##. However, you need to start from near the solution, and starting from some points can lead to disaster; for example, starting from ##x_0 = 2## give you ##x_1 \doteq -22.617##, and if you choose another ##x_0## near ##2## you can even make ##x_1 < -10^{100}##. Practical implementations of Newton's method build in various "safeguards" to prevent that behavior from occurring, but they can sometimes slow down the convergence rate.

    Basically, the way modern "global optimization" packages work is by a sophisticated implementation of "guessing", although there are some methods for 1-variable problems that avoid guessing or trial-and-error. One well-studied method is that of Bruno Shubert (B. Schubert, "A Sequential Method Seeking the Global Maximum of a Function", SIAM Journal on Numerical Analysis (1972), Volume 9, #3, pp. 379-388), but newer variants exist now that may be much more efficient---I haven't kept up with that literature.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted