Haskell library which provides some techniques to create interpolation polynomial.
Library provides two techniques of calculating interpolation:
- Lagrange
- Newton
- Square
-- imports
import Math.Interpolation
import Math.Interpolation.Point
import Math.Interpolation.Polynomial
-- calculate Lagrange Polynomial for these points (f(x) = x^2)
squarePolynomial = interpolateLagrange $ Points [Point (0, 0), Point (2, 4), Point (-2, 4)]
-- or we can use Newton algorithm
squarePolynomial = interpolateNewton $ Points [Point (0, 0), Point (2, 4), Point (-2, 4)]
-- or we can use square algorithm
squarePolynomial = interpolateSquares 2 $ Points [Point (0, 0), Point (2, 4), Point (-2, 4)]
-- get function from received Polynomial
square = toFunc $ squarePolynomial
-- call function
square 10 -- 100.0
To generate documentation run
cabal haddock
To run test run
cabal test