简体   繁体   English

R:(如何)nlm 函数可以用于多变量优化

[英]R: (How) can the nlm function be used for optimization with multiple variables

Can the nlm function be used for optimization with multiple variables? nlm 函数可以用于多变量优化吗? How would that work?这将如何运作?

For instance: I want to find x and y so that f(x,y) is minimized.例如:我想找到 x 和 y 以使 f(x,y) 最小化。 How would the nlm function work? nlm 函数将如何工作?

something like that?:类似的东西?:

nlm(f,c(0.1,0.1))

Make a function that receives a vector:制作一个接收向量的函数:

f <- function(X) {
  x <- X[1]
  y <- X[2]
  (x-3.14)^2 + (y-6.28)^2
}
nlm(f,c(0.1,0.1))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM