Copyright | (c) 2012 Aleksey Khudyakov |
---|---|
License | BSD3 |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Function for evaluating polynomials using Horher's method.
Synopsis
- evaluatePolynomial :: ( Vector v a, Num a) => a -> v a -> a
- evaluateEvenPolynomial :: ( Vector v a, Num a) => a -> v a -> a
- evaluateOddPolynomial :: ( Vector v a, Num a) => a -> v a -> a
- evaluatePolynomialL :: Num a => a -> [a] -> a
- evaluateEvenPolynomialL :: Num a => a -> [a] -> a
- evaluateOddPolynomialL :: Num a => a -> [a] -> a
Polynomials
Evaluate polynomial using Horner's method. Coefficients starts from lowest. In pseudocode:
evaluateOddPolynomial x [1,2,3] = 1 + 2*x + 3*x^2
evaluateEvenPolynomial Source #
Evaluate polynomial with only even powers using Horner's method. Coefficients starts from lowest. In pseudocode:
evaluateOddPolynomial x [1,2,3] = 1 + 2*x^2 + 3*x^4
evaluateOddPolynomial Source #
Evaluate polynomial with only odd powers using Horner's method. Coefficients starts from lowest. In pseudocode:
evaluateOddPolynomial x [1,2,3] = 1*x + 2*x^3 + 3*x^5
Lists
evaluatePolynomialL :: Num a => a -> [a] -> a Source #
evaluateEvenPolynomialL :: Num a => a -> [a] -> a Source #
evaluateOddPolynomialL :: Num a => a -> [a] -> a Source #