úκµÄA      !"#$%&'()*+,-./0123456789:;<=>?@ ABABAB CDEF#Little-Endian (head is const term) (Big-Endian (head is highest-order term) GHHTrim zeroes from a polynomial (given a predicate for identifying zero). J In particular, drops zeroes from the highest-order coefficients, so that  -0x^n + 0x^(n-1) + 0x^(n-2) + ... + ax^k + ..., a /= 0  is normalized to  ax^k + .... The I instance for # and all the standard constructors / destructors  are defined using  trim (0==). Make a D from a list of coefficients using the specified coefficient order. JMake a D from a list of coefficients using the specified coefficient order,  without the K: context (and therefore without trimming zeroes from the  coefficient list) Get the coefficients of a a  in the specified order. LGet the coefficients of a a % in the specified order, without the K 5 constraint (and therefore without trimming zeroes). #This function does not respect the I instance:  x == y =/=> &rawPolyCoeffs e x == rawPolyCoeffs e y.  HJL HJL The polynomial "0" The polynomial "1" The polynomial (in x) "x" Given some constant k+, construct the polynomial whose value is  constantly k. Given some scalar s and a polynomial f, computes the polynomial g  such that: ! evalPoly g x = s * evalPoly f x Given some polynomial f, computes the polynomial g such that: & evalPoly g x = negate (evalPoly f x) Given polynomials f and g, computes the polynomial h such that: , evalPoly h x = evalPoly f x + evalPoly g x Given polynomials f and g, computes the polynomial h such that: , evalPoly h x = evalPoly f x * evalPoly g x MI(Internal): multiply polynomials in LE order. O(length xs * length ys). Given a polynomial f and exponent n, computes the polynomial g  such that: ! evalPoly g x = evalPoly f x ^ n Given polynomials a and b, with b not , computes polynomials  q and r such that:  addPoly (multPoly q b) r == a composePoly f g constructs the polynomial h such that:  & evalPoly h = evalPoly f . evalPoly g JThis is a very expensive operation and, in general, returns a polynomial 5 that is quite a bit more expensive to evaluate than f and g together C (because it is of a much higher order than either). Unless your C polynomials are quite small or you are quite certain you need the F coefficients of the composed polynomial, it is recommended that you  simply evaluate f and g' and explicitly compose the resulting 7 functions. This will usually be much more efficient. NI(internal) add a scalar to a list of polynomial coefficients in LE order HEvaluate a polynomial at a point or, equivalently, convert a polynomial . to the function it represents. For example,  evalPoly   = O and   evalPoly (  k) = P k. DEvaluate a polynomial and its derivative (respectively) at a point. GEvaluate a polynomial and all of its nonzero derivatives at a point.  This is roughly equivalent to: ^ evalPolyDerivs p x = map (`evalPoly` x) (takeWhile (not . polyIsZero) (iterate polyDeriv p)) "Contract"2 a polynomial by attempting to divide out a root. contractPoly p a returns (q,r) such that q*(x-a) + r == p  gcdPoly a b8 computes the highest order monic polynomial that is a  divisor of both a and b . If both a and b are , the  result is undefined. QM(internal) Normalize a polynomial so that its highest-order coefficient is 1 (Compute the derivative of a polynomial. =Compute the definite integral (from 0 to x) of a polynomial. GSeparate a nonzero polynomial into a set of factors none of which have F multiple roots, and the product of which is the original polynomial. F Note that if division is not exact, it may fail to separate roots. ' Rational coefficients is a good idea. CUseful when applicable as a way to simplify root-finding problems.    &The Bernstein basis polynomials. The nth inner list is a basis for  the polynomials of order n or lower. The nth basis consists of n  polynomials of order n which sum to 1, and have roots of varying  multiplicities at 0 and 1. evalBernstein n v x evaluates the v'!th Bernstein polynomial of order n  at the point x. bernsteinFit n f: Approximate a function f as a linear combination of  Bernstein polynomials of order n'. This approximation converges slowly  but uniformly to f on the interval [0,1]. !)Evaluate a polynomial given as a list of n coefficients for the nth  Bernstein basis. Roughly: T evalBernsteinSeries cs = sum (zipWith scalePoly cs (bernstein !! (length cs - 1))) " de Casteljau'9s algorithm, returning the whole tableau. Used both for 9 evaluating and splitting polynomials in Bernstein form. #FGiven a polynomial in Bernstein form (that is, a list of coefficients  for a basis set from , such as is returned by  )  and a parameter value x0, split the polynomial into two halves, mapping  [0,x] and [x,1] respectively onto [0,1]. CA typical use for this operation would be to split a Bezier curve  (inserting a new knot at x).  !"# !"# !"#$1The Chebyshev polynomials of the first kind with R coefficients. %&!Compute the coefficients of the n'+th Chebyshev polynomial of the first kind. '!Compute the coefficients of the n',th Chebyshev polynomial of the second kind. (Evaluate the n':th Chebyshev polynomial of the first kind at a point X. E Both more efficient and more numerically stable than computing the - coefficients and evaluating the polynomial. )GEvaluate all the Chebyshev polynomials of the first kind at a point X. *Evaluate the n';th Chebyshev polynomial of the second kind at a point X. E Both more efficient and more numerically stable than computing the - coefficients and evaluating the polynomial. +HEvaluate all the Chebyshev polynomials of the second kind at a point X. ,Evaluate the n'5th Chebyshev polynomials of both kinds at a point X. -CEvaluate all the Chebyshev polynomials of both kinds at a point X. .Compute the roots of the n'+th Chebyshev polynomial of the first kind. /#Compute the extreme points of the n'+th Chebyshev polynomial of the first kind. 0chebyshevFit n f" returns a list of N coefficients cs such that  f x ~= sum (zipWith (*) cs (evalTs x)) on the interval -1 < x < 1. The N roots of the N'3th Chebyshev polynomial are the fitting points at M which the function will be evaluated and at which the approximation will be 8 exact. These points always lie within the interval -1 < x < 1. Outside 8 this interval, the approximation will diverge quickly. JThis function deviates from most chebyshev-fit implementations in that it I returns the first coefficient pre-scaled so that the series evaluation E operation is a simple inner product, since in most other algorithms J operating on chebyshev series, that factor is almost always a nuissance. 1EEvaluate a Chebyshev series expansion with a finite number of terms. GNote that this function expects the first coefficient to be pre-scaled  by 1/ 2, which is what is produced by 0. Thus, this computes M a simple inner product of the given list with a matching-length sequence of  chebyshev polynomials. $%&'()*+,-./01$%&'()*+,-./01$%&'()*+,-./01S2HReturns the Lagrange basis set of polynomials associated with a set of 9 points. This is the set of polynomials each of which is 1 at its + corresponding point in the input list and 0 at all others. BThese polynomials are especially convenient, mathematically, for C interpolation. The interpolating polynomial for a set of points (x,y)  is given by using the y*s as coefficients for the basis given by  lagrangeBasis xs6. Computationally, this is not an especially stable  procedure though. -Math.Polynomial.Interpolation.lagrangePolyFit B implements a slightly better algorithm based on the same idea. AGenerally it is better to not compute the coefficients at all.  (Math.Polynomial.Interpolation.polyInterp evaluates the interpolating J polynomial directly, and is both quicker and more stable than any method + I know of that computes the coefficients. 3Construct the Lagrange master polynomial$ for the Lagrange barycentric form: L That is, the monic polynomial with a root at each point in the input list. 4BCompute the weights associated with each abscissa in the Lagrange  barycentric form. 2342342345HEvaluate a polynomial passing through the specified set of points. The H order of the interpolating polynomial will (at most) be one less than  the number of points given. 6)Computes the tableau generated by Neville's algorithm. Each successive P row of the table is a list of interpolants one order higher than the previous, J using a range of input points starting at the same position in the input  list as the interpolant's position in the output list. 7<Computes the tableau generated by a modified form of Neville' s algorithm N described in Numerical Recipes, Ch. 3, Sec. 2, which records the differences K between interpolants at each level. Each pair (c,d) is the amount to add  to the previous level'3s interpolant at either the same or the subsequent 9 position (respectively) in order to obtain the new level's interpolant. H Mathematically, either sum yields the same value, but due to numerical + errors they may differ slightly, and some "paths" through the table 4 may yield more accurate final results than others. 8CFit a polynomial to a set of points by iteratively evaluating the  interpolated polynomial (using 5) at 0 to establish the F constant coefficient and reducing the polynomial by subtracting that  coefficient from all y''s and dividing by their corresponding x's.  Slower than 9% but stable under different sets of  conditions. DNote that computing the coefficients of a fitting polynomial is an K inherently ill-conditioned problem. In most cases it is both faster and  more accurate to use 5 or 7 instead of evaluating  a fitted polynomial. 9LFit a polynomial to a set of points using barycentric Lagrange polynomials. DNote that computing the coefficients of a fitting polynomial is an K inherently ill-conditioned problem. In most cases it is both faster and  more accurate to use 5 or 7 instead of evaluating  a fitted polynomial. 567895678956789:The Legendre polynomials with T# coefficients. These polynomials L form an orthogonal basis of the space of all polynomials, relative to the  L2 inner product on [-1,1]/ (which is given by integrating the product of ! 2 polynomials over that range). ;!Compute the coefficients of the n'th Legendre polynomial. <Evaluate the n':th Legendre polynomial at a point X. Both more efficient L and more numerically stable than computing the coefficients and evaluating  the polynomial. =4Evaluate all the Legendre polynomials at a point X. >Evaluate the n':th Legendre polynomial and its derivative at a point X. D Both more efficient and more numerically stable than computing the - coefficients and evaluating the polynomial. ?Zeroes of the n'th Legendre polynomial. :;<=>?:;<=>?:;<=>?@FReturns the Newton basis set of polynomials associated with a set of C abscissas. This is the set of monic polynomials each of which is 0 + at all previous points in the input list. @@@ U         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN  O P Q R STUV WTXY Z[\T]^T]_`abcdTefgpolynomial-0.6Math.PolynomialMath.Polynomial.BernsteinMath.Polynomial.ChebyshevMath.Polynomial.LagrangeMath.Polynomial.InterpolationMath.Polynomial.LegendreMath.Polynomial.NewtonData.List.ZipSumMath.Polynomial.TypeMath.Polynomial.PrettyMath.Polynomial.NumInstancePoly EndiannessLEBEpoly polyCoeffs polyIsZero polyIsOnezeroonex constPoly scalePoly negatePolyaddPolysumPolysmultPolypowPoly quotRemPolyquotPolyremPoly composePolyevalPoly evalPolyDerivevalPolyDerivs contractPolygcdPoly polyDeriv polyIntegral separateRoots bernstein evalBernstein bernsteinFitevalBernsteinSeries deCasteljausplitBernsteinSeriestsustuevalTevalTsevalUevalUsevalTUevalTsUstRootstExtrema chebyshevFitevalChebyshevSeries lagrangeBasislagrangelagrangeWeights polyInterpneville nevilleDiffsiterativePolyFitlagrangePolyFit legendreslegendre evalLegendre evalLegendresevalLegendreDeriv legendreRoots newtonBasiszipSumzipSumV endianness_trimmedcoeffsdropEndtrimbase GHC.ClassesEqrawPolyGHC.NumNum rawPolyCoeffs multPolyLE addScalarLEGHC.Baseidconstmonic integer-gmpGHC.Integer.TypeIntegerselectGHC.RealRational