[R] Linear system

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed May 25 14:53:18 CEST 2005



Jim Gustafsson wrote:
> Dear R-help
> 
> I have a problem solving a linear system like
> 
> 353a+45b+29c=79
> 45a+29b+3c=5
> 29a+3b+4c=8
> 
> Is there any way of doing this in R?
> 
> Best Regards
> Jim
> 


Use ?solve:

X <- matrix(c(353, 45, 29,
                45, 29,  3,
                29,  3,  4), 3, 3, byrow = TRUE)
y <- c(79, 5, 8)
b <- solve(X, y)

Have you read the posting guide? In particular, have you tried simple 
queries using help.search or the R archives? This question has been 
answered many times.

HTH,

--sundar




More information about the R-help mailing list