[R] solving nonlinear system of equations

Gabor Grothendieck ggrothendieck at gmail.com
Fri Mar 24 12:03:05 CET 2006


There was an error with the parentheses.  Here it is corrected:

 optim(c(1,1), function(x) (exp(x[1])-x[2])^2 + log(x[2])^2)


On 3/24/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> Minimize the sum of the squares of the differences between the
> two sides:
>
> optim(c(1,1), function(x) exp(x[1]-x[2])^2 + log(x[2])^2)
>
>
> On 3/24/06, allan_sta_staff_sci_main_uct at mail.uct.ac.za
> <allan_sta_staff_sci_main_uct at mail.uct.ac.za> wrote:
> > hi all
> >
> > i have been searching through the archives in search for some help and it seems
> > to have been fruitless - thus the mail. i saw some mail relating to mathomatic
> > and maxima. mathomatic only works for simpel functions - as per the mail and
> > does not support logs ...- and i am not familiar with maxima. i would
> > preferably want to use an R function.
> >
> >
> >
> > is there a function that can solve a system of non linear equations. i dont have
> > any data - ie as per nls.
> >
> >
> >
> > so a trivial example would be:
> >
> > exp(a) = v
> > log(v) = 0
> >
> >
> >
> > and we need to solve for v and a.
> >
> > hoping someone can help.
> > /
> > allan
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
>




More information about the R-help mailing list