I want to calculate local maximums and minimums for: $$y = (a + bx) \cos{x}$$
The derivative is: $$\dfrac{dy}{dx} = b \cos{x} - (a+bx)\sin{x}$$
I then tried to graph these functions to find where $\dfrac{dy}{dx}=0$, but the points where the derivative is equal to zero don't exactly coincide with the local maximums of the original function.
For this example, the constants are $a=180$ and $b=0.25$.
The red line is the function and the blue is the derivative. As you can see, the derivative equals zero when $x=360.053$, but the function is not at its maximum on that point. It reaches the maximum at $x=363.028$.
Can someone tell me what's happening? I think the slope should be zero exactly where the maximum is. Did I do anything wrong?

