Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Derivative and Numerical approach

  1. Nov 9, 2017 #1

    I am dealing with a function f(x) involving various complicated trig functions. I took the first derivative of the function f(x), which is doable, and set it to zero to find the at which value x the function f(x) would be maximum. However, once I have the derivative of f(x), it does not seem possible to isolate x and solve for it...

    What does it mean to solve the problem numerically? Does it simply mean taking the function representing the derivative, plugging in a series of x values, and searching for the value(s) that make the function zero?

  2. jcsd
  3. Nov 9, 2017 #2


    User Avatar
    Science Advisor

    1. The first step is to make a graph of the function and it's derivative. This will give you an approximate answer for where the maximum is. Then you can apply a method like the Newton-Raphson method to find the value where the derivative is zero. If you have the function programmed into a computer, which you will probably need to do to make a graph, it's also possible to just do a binary search to find the maximum. You take two values on either side of the max, which you can find by looking at the graph, and just keep dividing the interval in half until you find the maximum to the desired accuracy.
  4. Nov 10, 2017 #3
    Thank ou phyzguy.

    what if I just plotted the derivative and then wrote a matlab routine to search for the zero or lowest value? I wouldn't need to do any numerical method in that case, right?

  5. Nov 10, 2017 #4


    Staff: Mentor

    Matlab is working with numbers here, rather than symbolically finding an answer. By writing a matlab routine, you are indirectly using numerical methods to find the zero (or lowest value).
  6. Nov 11, 2017 #5
    Is everybody clear as to what the OP means by "solve the problem?" I never saw a statement of what the problem is, so I'm not sure what he wants. Is he looking for a zero of the original function, or something else? Taking a derivative may be useful for applying Newton's method to that, but finding a zero of the derivative is not.
  7. Nov 11, 2017 #6


    User Avatar
    Science Advisor
    Education Advisor

    So, he would like to solve for the zeros of the derivative in order to determine the maximum of the original function. In order to do this using Newton, he would have to compute the second derivative numerically or symbolically.
  8. Nov 12, 2017 #7


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Most non-linear optimization methods will not solve for zeros of the derivative of f(x). Instead, they start at a value of x=x0 and use the derivative f'(x0) to direct them to a second guess, x1. The process is repeated at x1 to move to a better x value, x2. The algorithm continues iterating to better values of xn till a termination criteria is achieved.

    PS. If the algorithms do not solve for zeros of f'(x), they often do approximate f' with a linear or second order function that they do solve for zero. That can speed up the iterative process.
    Last edited: Nov 13, 2017
  9. Nov 13, 2017 #8
    Thank you everyone for the insight.

    I have made some progress working on the derivative function which results now to be the product of two sub-functions. By finding the zeros of each sub-function would I also automatically find the zeros of the entire function? In general, are the zeros of the multiplied functions also the zeros of the entire function?
  10. Nov 13, 2017 #9


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Yes, as long as the other factors do not go to infinity at the same location. Multiplying any real number by zero gives a zero.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted