[R] Solving two nonlinear equations with two knowns

Berend Hasselman bhh at xs4all.nl
Fri Jul 17 11:04:51 CEST 2009



yhsu6 wrote:
> 
> Dear R users, 
> 
> I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use
> optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal
> solution changes when I change initial values. How to solve this? 
> 
> BTW, I also try to use grid searching. But I have no information on ranges
> of x1 and x2, respectively. 
> 
> 

Without showing f1 and f2 it is not possible to say anything definite.
You don't tell us if optim found a (x1,x2) for which  f1 and f2 = 0.
Minimizing f1^2+f2^2 is not the same as finding a solution f1=0 and f2=0.

You can try package "nleqslv" which is intended to solve systems of non
linear equations. Or "BB".

If your system has more than one solution, it can happen that changing the
starting point leads to a different final point.

Berend

-- 
View this message in context: http://www.nabble.com/Solving-two-nonlinear-equations-with-two-knowns-tp24528892p24530991.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list