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

______________________________________________
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