Thx,
Apparantely it is possible to find a solution.
I need to check this out more securly because the final result you've gave
me seemed a bit strange, but not impossible.
Is it also possible to add some constraints?
Like x,y,c,d > 0
and x<c, y<d
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Alan Hochberg
Sent: 07 September 2006 21:27
To: 'Bert Jacobs'; s-news@lists.biostat.wustl.edu
Subject: Re: [S] Solving NonLinear Equations
Bert,
Note that your equations are non-linear but not inherently multivariate.
They can be easily transformed to a univariate form that can be solved with
the uniroot() function. The following is quick-and-dirty, with just a guess
providing me with an interval for X that contained a sign change:
solveEquations <- function() {
f <- function(x) {
y <- 0.320 * x
c <- 3059738 - 0.62653 * x
d <- 783717 - 0.53653 * y
resid <- ((((5.52868E-08*x*c) + d - (2.04766E-07*d*x))/c) -
0.256138456)
resid
}
solve <- uniroot(f, c(-9999.0, 9999.0))
x <- solve$root
cat ("x = ",x,"\n")
y <- 0.320 * x
c <- 3059738 - 0.62653 * x
d <- 783717 - 0.53653 * y
resid <- ((((5.52868E-08*x*c) + d - (2.04766E-07*d*x))/c)
0.256138456)
cat ("y = ",y,"\n")
cat ("c = ",c,"\n")
cat ("d = ",d,"\n")
cat ("residual = ",resid,"\n")
}
I got:
x = 171.346006636828
y = 54.8307221237849
c = 3059630.64658646
d = 783687.581672659
residual = 1.31006316905768e-014
Hope this helps,
Alan
Alan Hochberg
Vice President, Research
ProSanos Corp.
225 Market Street
Suite 502
Harrisburg, PA 17101
Tel. 717-635-2124
Fax 717-635-2575
alan.hochberg@prosanos.com
www.prosanos.com
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|