If A is a squared matrix, solve(A) gives the inverse of A; if you have a
system of linear equation AX=B, solve(A,B) gives the solution to this system
of equations. For example:

   x-2y =1
-2x+3y=-3

> A=matrix(c(1,-2,-2,3), ncol=2, byrow=T)
> B=c(1,-3)
> 
> # to get the inverse of A
> solve(A)
     [,1] [,2]
[1,]   -3   -2
[2,]   -2   -1
> # to get the solution to the system of equation
> solve(A,B)
[1] 3 1



-- 
View this message in context: 
http://r.789695.n4.nabble.com/What-solve-does-tp2402922p2526066.html
Sent from the R help mailing list archive at Nabble.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.

Reply via email to