Finding the maximum value of a function

In summary: 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.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
  • #1
yugeci
61
0

Homework Statement



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

Homework Equations



upload_2015-12-4_16-13-34.png
[/B]

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?
 
Physics news on Phys.org
  • #2
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:
  • #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.
 

Attachments

  • 1.jpg
    1.jpg
    61.6 KB · Views: 434
  • 2.jpg
    2.jpg
    62.5 KB · Views: 442
  • #4
yugeci said:
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.
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
 
  • Like
Likes yugeci
  • #5
I thought that method was for root finding? I am finding the maximum value of a function. Unless my concepts are wrong here..
 
  • #6
99ca3ee7752a4df7bf1c4bbb7c963595.png
(##\leftarrow##clickable link) is what they say in general. Makes much more sense if you look at it.
Nice picture too: here
 
  • #7
yugeci said:
I thought that method was for root finding? I am finding the maximum value of a function. Unless my concepts are wrong here..
You're right. Late nite. Scratch that post.
 
  • #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:
 

Attachments

  • upload_2015-12-4_16-56-34.png
    upload_2015-12-4_16-56-34.png
    3.3 KB · Views: 438
  • #9
yugeci said:

Homework Statement



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

Homework Equations



View attachment 92880[/B]

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?
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.
 
  • #10
Interesting. I just realized 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?
 
  • #11
SteamKing said:
You're right. Late nite. Scratch that post.
Woops, me 2 ! o:) o:)
 
  • #12
yugeci said:

Homework Statement



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

Homework Equations



View attachment 92880[/B]

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?

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.
 
  • Like
Likes BvU

Related to Finding the maximum value of a function

What is the definition of the maximum value of a function?

The maximum value of a function is the highest point on the graph of the function. It is also known as the global maximum, as it represents the largest value that the function can reach.

How do you find the maximum value of a function algebraically?

To find the maximum value of a function algebraically, you must first take the derivative of the function and set it equal to 0. Then, solve for the value of x. Plug this value back into the original function to find the corresponding y-value, which is the maximum value of the function.

What is the role of the first and second derivative tests in finding the maximum value of a function?

The first derivative test is used to determine the critical points of a function, where the function's slope changes from positive to negative or vice versa. The second derivative test is used to determine the nature of these critical points, whether they are maximum, minimum, or inflection points. The maximum value of a function occurs at a critical point where the second derivative is negative.

Can a function have more than one maximum value?

No, a function can have only one maximum value. This is because the maximum value represents the highest point on the graph of the function, and there can only be one highest point.

Is finding the maximum value of a function important in real-world applications?

Yes, finding the maximum value of a function is crucial in real-world applications, especially in fields such as economics, physics, and engineering. It helps determine the optimal solution to problems, such as maximizing profits or minimizing costs.

Similar threads

  • Calculus and Beyond Homework Help
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
424
  • Calculus and Beyond Homework Help
Replies
8
Views
530
  • Calculus and Beyond Homework Help
Replies
2
Views
698
Replies
1
Views
953
  • Calculus and Beyond Homework Help
Replies
2
Views
948
  • Calculus and Beyond Homework Help
Replies
10
Views
2K
  • Calculus and Beyond Homework Help
Replies
6
Views
5K
  • Calculus and Beyond Homework Help
Replies
2
Views
955
Back
Top