Re: [R] can R solve these paired equations

From: Charilaos Skiadas <cskiadas_at_gmail.com>
Date: Mon, 17 Dec 2007 01:39:24 -0500

Turn your problem into an optimization one and use the various optimization abilities of R, for instance have a look at nlm:

?nlm

As an example to solve the rather simple: x-y=0
x+y=2

We could do:

f <- function(vals) {

	x <- vals[1]
	y <- vals[2]
	sum(c(x-y,x+y-2)^2)

}
nlm(f, c(2,2))

PS: A google search for "rhelp solving nonlinear system of equations" would likely have given you some starting points. PS2: Perhaps someone more expert could comment on the differences between optim, nlm and nlminb.

Haris Skiadas
Department of Mathematics and Computer Science Hanover College

On Dec 17, 2007, at 12:43 AM, Xin wrote:

> Dear:
>
>
>
> I have a paired equation below. Can I solve (x,y) using R.
>
>
>
> Thanks!
>
>
>
> Xin
>
>
>
> A=327.727
>
> B=9517.336
>
> p=0.114^10
>
>
>
> (1-p)*y*(1-x)/x/(1-x^y)=A
>
> A(1+(1-x)*(1+y)/x-A))=B



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 17 Dec 2007 - 06:44:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 08:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.