I want to determine the value of z = z1, ..., zn such that
z1 = g1(z1,..,zn)
...
zn = gn(z1,..,zn)
for some nonlinear gi(z1,..,zn), 1<=i<=n. And I declared the function:
vecfun <- function(z){
fun1 <- z1 - g1(z1,..,zn)
...
funn <- zn - gn(z1,..,zn)
return(c(fun1, ..., funn))
}
Then, I will call:
sol <- nleqslv(cond0, vectfun)
And I get some output different from cond0 (I also had some times when the output/solution allegedly is the same as cond0, but in reality, it isn't). However when I do:
vecfun(sol$x)
The results aren't zero, nor something relatively close. In principle, nleqslv should return the z's that solve the system for vectfun to be the n-dimensional zero vector (right?). But why doesn't it hold when I try to confirm it?
Any help is highly appreciated as well as alternative methods to find roots of vector functions.