Re: [R] Evaluate function on a grid

2008-02-16 Thread David Winsemius
"Giu Mac" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I have a function in R^2, say > > f <- function(x,y) { ...skipped } > > I want to plot this function using contour, persp. wireframe, etc. I > know that the function has a global > minimum at (x0, y0) > > The naive approach is to

[R] Evaluate function on a grid

2008-02-16 Thread Giu Mac
I have a function in R^2, say f <- function(x,y) { ...skipped } I want to plot this function using contour, persp. wireframe, etc. I know that the function has a global minimum at (x0, y0) The naive approach is to evaluate the function on the outer product of two arrays, like this: sx <- c(seq(