Dear List, I was wondering if there is a simple way to solve (equate) two functions in R. For example: (1) 5x + 3y = 30 (2) 12x - 2y = 26 I would like R to finde x = 3 and y = 5 Is there an implemented function in R or would I have to write an own function? Thank you very much for your help. -- View this message in context: http://r.789695.n4.nabble.com/Equate-two-or-more-functions-tp4587302p4587302.html Sent from the R help mailing list archive at Nabble.com.
Hello, Try (x <- matrix(c(5, 12, 3, -2), ncol=2)) (y <- c(30, 26)) solve(x, y) solve.qr(qr(x), y) (Use the second.) Also, see section 5.7.5 of the R-intro.pdf that comes with your (any) installation of R. Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Equate-two-or-more-functions-tp4587302p4587523.html Sent from the R help mailing list archive at Nabble.com.
On 25-04-2012, at 18:52, pannigh wrote:> Dear List, > I was wondering if there is a simple way to solve (equate) two functions in > R. For example: > > (1) 5x + 3y = 30 > (2) 12x - 2y = 26 > > I would like R to finde x = 3 and y = 5 > Is there an implemented function in R or would I have to write an own > function?And if your functions are nonlinear there is package nleqslv and BB. Berend