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(-3, x0, len = 100), seq(x0, 3, len = 100)[-1])
sy <- c(seq(-3, y0, len = 100), seq(y0, 3, len = 100)[-1])

fout <- outer( sx, sy, f)
persp(fout)

This works pretty well, but I would like to achieve better results by using
information o the curvature of
the function.
I know that the curvature of the function is very high in a neighborhood of
(x0, y0), but it
is rather flat for (x,y) not belonging to this neighborhood.

So in principle I have to choices: increase the number of points were the
function is evaluated; evaluate the function more densely  in a neighborhood
of (x0,y0) and more sparsely outside that neighborhood.

Since the function is rather costly to evaluate, I would like to efficiently
use the information on the curvature. Does anybody has a suggestion on out
to form sx and sy in such a way to reflect the curvature of the function?

I can make this on a per cases base, but I would like to have an automatic
procedure.

Thank you for your help.

Jo Ragauss

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to