Reputation: 1
I've tried using the functions D() and deriv() to derive the function, but the output is an expression so I can't use the method optimize() to get the maximum of the derivative.
Upvotes: 0
Views: 121
Reputation: 15123
Try using Deriv::Deriv() function instead. It returns function, not expression. For a simple example,
f <- function(x) x^2
Deriv(f)
result is
function (x)
2 * x
Now you can optimize() that derivative
Upvotes: 1