Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图得到 x 的值,这将使我的方程 y 最小化。我想用R。
方程是:
y= [(a-bx)^2] / {[2bx /(1+x)]+c} 其中 a、b、c 都是常数,但彼此不同。
y= [(a-bx)^2] / {[2bx /(1+x)]+c}
谢谢。
对于简单的一维最小化,标准优化函数应该足够了:
a <- 2 b <- 1 c <-1 func <- function(x){(a-b*x)^2/((2*b*x/(1+x))+c)} optimize(f=func, interval = c(-3,3))
$minimum [1] -0.3333377
$objective [1] -277201.4