Skip to content
Prev 30926 / 398506 Next

nonlinear equation solver?

Dear Wang:

You can solve nonlinear equations (multiple variables) with "optim" using a
trick as follows:
Suppose your equations are:
f1(x1,x2,...,xn) = 0
f2(x1,x2,...,xn) = 0
.
.
.
fn(x1,x2,...,xn) = 0

You simply create a quadratic objective function, which is the sum of the
squared values of all functions, i.e.
f(x1,x2,...,xn) = f1^2 + f2^2 + ... + fn^2
 Minimizing this objective function is equivalent to solving simultaneous
nonlinear equations.

Hope this help,

Ravi.
----- Original Message -----
From: "Wang, Zhu" <zhuw at mail.smu.edu>
To: <maj at waikato.ac.nz>; <pburns at pburns.seanet.com>;
<spencer.graves at pdf.com>
Cc: <r-help at stat.math.ethz.ch>
Sent: Monday, April 21, 2003 11:25 AM
Subject: RE: [R] nonlinear equation solver?
function already in R or S. I guess I have to implement some C codes then.
nonlinear equation from Patrick's advice.