LeastSquaresTest.frink

Download or view LeastSquaresTest.frink in plain text format


/** This tests the least-squares fitting routines in LeastSquares.frink */

use LeastSquares.frink

points = [[1,1], [2,3], [3,3], [4,5], [6,4]]

// Fit the values to a polynomial of the specified degree
ls = LeastSquares.fitDegree[points, 2]

println[ls.toMatrix[].formatMatrix[]]
symbolicMode[true]
println[ls.toExpression[]]

println[ls.toArray[]]
println["Residual is " + ls.residual[]]


Download or view LeastSquaresTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20145 days, 21 hours, 40 minutes ago.