[R] Solving derivates, getting the minimum of a function, and helpful documentation of the deriv function

Sorkin, John j@ork|n @end|ng |rom @om@um@ry|@nd@edu
Sat Aug 29 23:15:56 CEST 2020


I am trying to find the minimum of a linear function:

y <- (-0.0263*b) + (0.0010*B^2)

I am having GREAT difficulty with the documentation of the deriv function. I have (after playing for two-hours) been able to get the following to work:

zoop <- deriv(expression((-0.0263*B)+(0.0010*B^2)),"B",func=TRUE)
class(zoop)
zoop(2)

which appears to give me the value of the derivative of my expression w.r.t. B
(I am not certain what the func arugment does, but it appears to be necessary)

Following what one learns in calculus 1, I now need to set the derivative equal to 0 and solve for B. I have no idea how to do this

Can someone point me in the right direction. Additionally can someone suggest documentation for deriv that is easily intelligible to someone who wants to learn how to use the function, rather that documentation that helps one who is already familiar with the function. (I have a need for derivatives that is beyond finding the minimum of a function)

Thank you
John

P.S. Please don�t flame. I spent a good deal of time looking at documentation and searching the internet. There may be something on line, but I clearly am not using the correct search terms.







	[[alternative HTML version deleted]]



More information about the R-help mailing list