[R] Solutions of equation systems
Moreno Mancosu
nomero at tiscali.it
Sat Aug 15 12:29:28 CEST 2009
Greg Snow wrote:
> ?solve
>
>
Dear Greg,
I tried to use function "solve", but I have some problems with it.
Let's try with a simple equation:
x + 3y -2z = 5
3x + 5y + 6z =7
> a<-matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3)
> a
[,1] [,2] [,3]
[1,] 1 -2 5
[2,] 3 3 6
> b<-matrix(c(5,7),nrow=2,ncol=1)
> b
[,1]
[1,] 5
[2,] 7
When I try to solve this system, I find this error:
> solve(a,b)
Error in solve.default(a, b) : 'b' must be compatible with 'a'
Also, when i try to solve a system with n equation and n variables,
solve works perfectly.
Thanks in advance!
Moreno
More information about the R-help
mailing list