# I Derivative and Numerical approach

1. Nov 9, 2017

### fog37

Hello,

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?

Thanks
Fog37

2. Nov 9, 2017

### phyzguy

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.

3. Nov 10, 2017

### fog37

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?

fog37

4. Nov 10, 2017

### 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).

5. Nov 11, 2017

### Dr.D

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.

6. Nov 11, 2017

### Krylov

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.

7. Nov 12, 2017

### FactChecker

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
8. Nov 13, 2017

### fog37

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?

9. Nov 13, 2017

### FactChecker

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.