sloisel / numeric

Numerical analysis in Javascript
http://www.numericjs.com/
Other
1.42k stars 176 forks source link

Problem? with numeric.inv() #54

Closed CorbinFoucart closed 9 years ago

CorbinFoucart commented 9 years ago

Hello, I am new to both JavaScript and Numeric.js, so I hope this is a relevant question.

I have the 10x10 matrix

A = [[0.42905681456828765, 0, 0, 0, 0, 1, 0, 1, 1, 0], [-0.9032775043542898, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -0.612571665435814, 0.3803746509932104, 0, 1, -1, 0, 0, 0, 0], [0, -0.7904150521752438, -0.9248324847678057, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, -0.6277524511897817, 0, 0, 0, 0, 1], [0, 0, 0, 0, -0.7784130394753294, 0, 0, 0, 0, 0], [0, 0, -0.3803746509932104, 0.6277524511897817, 0, 0, -0.9996144206527183, 0, 0, 0], [0, 0, 0.9248324847678057, 0.7784130394753294, 0, 0, 0.027767067240353285, 0, 0, 0], [-0.42905681456828765, 0.612571665435814, 0, 0, 0, 0, 0.9996144206527183, 0, 0, 0], [0.9032775043542898, 0.7904150521752438, 0, 0, 0, 0, -0.027767067240353285, 0, 0, 0]]

that I wish to invert, but when I call

Ainv = numeric.inv(A)

I receive an error like this: Uncaught TypeError: Cannot read property '9' of undefined numeric inv numeric-1.2.6. js:806 (anonymous function)

I am not certain that A is invertible, but for other certainly not invertible matrices I don't get this error. Is this a bug or something I am doing wrong?

Thanks, Corbin

reptillicus commented 9 years ago

That matrix is singular and not invertible.

sloisel commented 9 years ago

Hi,

Your matrix is singular.

http://numericjs.com/workshop.php?link=aafa021f4300f5f64edb9351a432f5573f7da16817a92efabce6fe76aa70672a

Thanks,

On Tue, Aug 12, 2014 at 3:52 PM, CorbinFoucart notifications@github.com wrote:

Hello, I am new to both JavaScript and Numeric.js, so I hope this is a relevant question.

I have the 10x10 matrix

A = [[0.42905681456828765, 0, 0, 0, 0, 1, 0, 1, 1, 0], [-0.9032775043542898, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -0.612571665435814, 0.3803746509932104, 0, 1, -1, 0, 0, 0, 0], [0, -0.7904150521752438, -0.9248324847678057, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, -0.6277524511897817, 0, 0, 0, 0, 1], [0, 0, 0, 0, -0.7784130394753294, 0, 0, 0, 0, 0], [0, 0, -0.3803746509932104, 0.6277524511897817, 0, 0, -0.9996144206527183, 0, 0, 0], [0, 0, 0.9248324847678057, 0.7784130394753294, 0, 0, 0.027767067240353285, 0, 0, 0], [-0.42905681456828765, 0.612571665435814, 0, 0, 0, 0, 0.9996144206527183, 0, 0, 0], [0.9032775043542898, 0.7904150521752438, 0, 0, 0, 0, -0.027767067240353285, 0, 0, 0]]

that I wish to invert, but when I call

Ainv = numeric.inv(A)

I receive an error like this: Uncaught TypeError: Cannot read property '9' of undefined numeric inv numeric-1.2.6. js:806 (anonymous function)

I am not certain that A is invertible, but for other certainly not invertible matrices I don't get this error. Is this a bug or something I am doing wrong?

Thanks, Corbin

— Reply to this email directly or view it on GitHub https://github.com/sloisel/numeric/issues/54.

Sébastien Loisel Assistant Professor Department of Mathematics, Heriot-Watt University Riccarton, EH14 4AS, United Kingdom web: http://www.ma.hw.ac.uk/~loisel/ email: S.Loisel at hw.ac.uk phone: +44 131 451 3234 fax: +44 131 451 3249

CorbinFoucart commented 9 years ago

Thanks everyone!

Corbin