On 09/02/2010 09:25 PM, benhartley903 wrote: > > Dear all, > I am relatively new to R and have had some difficulty in understanding the > user manual for a package that I have downloaded to evaluate non-linear > simultaneous equations. > The package is called systemfit. > Does anyone have any experience of this package? > What I am trying to do is solve a non linear simultaneous equations... > > Could anyone give me an example (please) of the code that would be needed to > return solutions for the following system using systemfit (or any other > better package): > > y=1/x > y=sin(x) > > within a range of say x=-10 to 10 (x in radians) > > Thanks, I really appreciate your help in advance. > > Ben
Systemfit is not even in the same ballpark...! I'd just rewrite the above as x * sin(x) - 1 = 0 make a graph to bracket the roots and then use uniroot. > f <- function(x) x*sin(x)-1 > curve(f, interval=c(-10.10) > f(c(0,2,5,7,10)) [1] -1.0000000 0.8185949 -5.7946214 3.5989062 -6.4402111 So the roots are > uniroot(f,interval=c(7,10))$root [1] 9.317241 > uniroot(f,interval=c(5,7))$root [1] 6.43914 > uniroot(f,interval=c(2,5))$root [1] 2.772631 > uniroot(f,interval=c(0,2))$root [1] 1.114161 and 4 more symmetrically below zero. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@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.