[R] nonlinear equation solver?
Ravi Varadhan
rvaradha at jhsph.edu
Mon Apr 21 18:21:28 CEST 2003
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?
> Thanks to all.
>
> I know how to solve it numerically but I am just wondering if there is a
function already in R or S. I guess I have to implement some C codes then.
>
> Thanks to Murray for good observation.
>
> I am not sure why optim function is working in general to solve a
nonlinear equation from Patrick's advice.
>
> -----Original Message-----
> From: Murray Jorgensen [mailto:maj at stats.waikato.ac.nz]
> Sent: Mon 4/21/2003 12:13 AM
> To: Wang, Zhu
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] nonlinear equation solver?
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list