For a start, there's two local minima. Add to that floating point errors. And possible assumptions by the package authors.
----begin code---- f <- function (x, y, sign) { unsign.z <- sqrt (1 - x^2 - y^2) 2 * (x^2 - sign * y * unsign.z) } north.f <- function (x, y) f (x, y, +1) south.f <- function (x, y) f (x, y, -1) N <- 100 p0 <- par (mfrow = c (1, 2) ) plotf_cfield (north.f, c (-1.1, 1.1), main="north", ncontours=10, n=N, raster=TRUE, hcv=TRUE) plotf_cfield (south.f, c (-1.1, 1.1), main="south", ncontours=10, n=N, raster=TRUE, hcv=TRUE) par (p0) ----end code ---- Please ignore R warnings. I'm planning to reinvent this package soon. And also, it wasn't designed for circular heatmaps. On Sat, May 22, 2021 at 8:02 PM Hans W <hwborch...@gmail.com> wrote: > > Yes. "*on* the unit sphere" means on the surface, as you can guess > from the equality constraint. And 'auglag()' does find the minimum, so > no need for a special approach. > > I was/am interested in why all these other good solvers get stuck, > i.e., do not move away from the starting point. And how to avoid this > in general, not only for this specific example. > > > On Sat, 22 May 2021 at 09:44, Abby Spurdle <spurdl...@gmail.com> wrote: > > > > Sorry, this might sound like a poor question: > > But by "on the unit sphere", do you mean on the ***surface*** of the sphere? > > In which case, can't the surface of a sphere be projected onto a pair > > of circles? > > Where the cost function is reformulated as a function of two (rather > > than three) variables. > >
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.