Re: [R] Equate two (or more) functions

2012-04-25 Thread Berend Hasselman
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 wr

Re: [R] Equate two (or more) functions

2012-04-25 Thread Rui Barradas
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.nab

[R] Equate two (or more) functions

2012-04-25 Thread pannigh
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.