[R] find max. value for a equation by optimize
Jianling Fan
fanjianling at gmail.com
Thu Oct 29 22:19:58 CET 2015
Hello, everyone,
I have a specific equation, When I draw it out, I found there is a
max. value for it at about x=5. but I couldn't point it out by
optimize(). Does anyone know why? Thanks!
my code is:
d50<-18.04
c<- -1.276
dm<-147
sm <- function (x) {
1/(1+(x/d50)^c)+(1-1/(1+(dm/d50)^c))*x/dm-(1/(1+((x-1)/d50)^c)+(1-1/(1+(dm/d50)^c))*(x-1)/dm)
}
curve(sm, 0,50)
optimize(sm,c(0,50))
The optimize() only give min. value but not max.
More information about the R-help
mailing list