phetsims / curve-fitting

"Curve Fitting" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

Automated Testing Error #108

Closed phet-steele closed 7 years ago

phet-steele commented 7 years ago

Caused by two points making an undefined slope (easier to NOT put them on top of each other). Had to fuzzMouse for about 2 hours to occur. It's much easier to repro by hand.

Uncaught Error: Matrix is singular.
    at LUDecomposition.solve (LUDecomposition.js?bust=1490215562460:178)
    at Matrix.solve (Matrix.js?bust=1490215562460:368)
    at FitMaker.getSolutionMatrix (FitMaker.js?bust=1490215562460:94)
    at FitMaker.getFit (FitMaker.js?bust=1490215562460:43)
    at Curve.updateFit (Curve.js?bust=1490215562460:326)
    at Emitter.emit2 (Emitter.js?bust=1490215562460:147)
    at Property._notifyObservers (Property.js?bust=1490215562460:208)
    at Property._setAndNotifyObservers (Property.js?bust=1490215562460:197)
    at Property.set (Property.js?bust=1490215562460:141)
    at Point.set [as position] (PropertySet.js?bust=1490215562460:124)
veillette commented 7 years ago

Matrix is Singular implies that the determinant of the solution matrix is zero, hence there is no inverse to the matrix. As a result, no solution exists for the a,b,c,d coefficients. Two points sharing the same x position lead to a slope of infinity.

I can commit a temporary solution where a solution a=b=c=d=0 is returned for cases where the determinant is nearly zero.. Long term, it would preferable to come up with an approach that indicates to the user that there is no curve fit for this arrangement of points.

veillette commented 7 years ago

The commit should resolve this ticket but doesn't address the larger issue of how to deal with such ill fitted curve . Let me close this issue and addressed these concerns in another issue.