Take the derivative of the function and set it to zero, then solve for theta. That will give you a point where R is either a local maximum or a local minimum. Then take the second derivative at that point: if the 2nd derivative is a negative value that means the function is accelerating downwards and the point is a local maximum; if the 2nd derivative is positive then the functionat that point is accelerating upwards and it's a local minimum.