sloisel / numeric

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

Numeric can not find a particular solution #33

Closed tomaszsm closed 11 years ago

tomaszsm commented 11 years ago

The library is unable to find solution to equation system: [[-0.8,0.4,0.3],[0.4,-0.8,0.3],[0.4,0.4,-0.6]] [[x1][x2][x3]] = [[0],[0],[0]]. The system has solutions: {x1 = 0.75r, x2 = 0.75r, x3 = r}

sloisel commented 11 years ago

Numeric is not a symbolic math library and cannot handle the symbolic column vector [x1,x2,x3]. That aside, your matrix is singular.

You are asking for a numerical computation of the kernel. This is difficult. Perhaps using numeric.svd() on your matrix would be a start.

tomaszsm commented 11 years ago

I have just written it in symbolic form to make the system more clear. To solve it I used form: numeric.solve([[-0.8,0.4,0.3],[0.4,-0.8,0.3],[0.4,0.4,-0.6]], [0,0,0]), or analogous for other solving functions. In this case the functions return: [NaN, NaN, NaN].

sloisel commented 11 years ago

I've already pointed out that the matrix is singular. This is the correct result.