numeric icon indicating copy to clipboard operation
numeric copied to clipboard

Problems solving Ax=b

Open ghost opened this issue 13 years ago • 2 comments

Hello there,

I am relatively new to linear algebra, but I think I may have spotted a bug. When using numeric.solve(A, b), it appears b can only be a column vector. Should it not also be allowed to be a rectangular matrix?

For instance:

A is 3x3 matrix b is 3x1 vector numeric.solve(A, b) returns the expected x vector

But:

A = 3x3 matrix b = 3x2 matrix numeric.solve(A, b) returns vector of NaN.

While one could just use numeric.dot(numeric.inv(A), b) to get the same result, I feel it should be part of the solve function. My apologies if I am incorrect here, I just thought it was worth mentioning.

Thanks for reading, Richard.

ghost avatar Dec 07 '12 06:12 ghost

You are correct, the b parameter in numeric.solve(A,b) must be a vector, although that's not a bug, that's just the way it's implemented. I will try to improve this in the future.

sloisel avatar Dec 07 '12 12:12 sloisel

Ok that's fair enough, sorry I am new to this stuff and don't understand it all conceptually yet. Thank you for the reply.

ghost avatar Dec 07 '12 13:12 ghost