sloisel / numeric

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

Bug in 'numeric.inv()' #28

Open tomaszsm opened 11 years ago

tomaszsm commented 11 years ago

Computing "numeric.inv([[8,9,8,9], [5,6,5,6], [8,9,8,9], [5,6,5,6]]);" results in an error: "TypeError: Aj is undefined"

sloisel commented 11 years ago

This matrix is not invertible; it seems to work when the matrix is invertible. Nevertheless, I will change this behavior.

RONNCC commented 11 years ago

what about calculating the pseudo inverse?

RONNCC commented 11 years ago
>>> import numpy.linalg
l
>>> numpy.linalg.pinv([[8,9,8,9], [5,6,5,6], [8,9,8,9], [5,6,5,6]])
array([[ 0.5       , -0.75      ,  0.5       , -0.75      ],
       [-0.41666667,  0.66666667, -0.41666667,  0.66666667],
       [ 0.5       , -0.75      ,  0.5       , -0.75      ],
       [-0.41666667,  0.66666667, -0.41666667,  0.66666667]])
>>> 
sloisel commented 11 years ago

Try this: http://www.numericjs.com/workshop.php?link=b923cdeb84e188a11b44e3e82e44897b3b7da1d6640ddb46ab7330a6625f8e19