úÎ!¢¸      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · (c) 2011 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNonemath-functions(Calculate relative error of two numbers: \frac{|a - b|}{\max(|a|,|b|)} ÙIt lies in [0,1) interval for numbers with same sign and (1,2] for numbers with different sign. If both arguments are zero or negative zero function returns 0. If at least one argument is transfinite it returns NaNmath-functions.Check that relative error between two numbers a and b. If  returns NaN it returns False.math-functions)Add N ULPs (units of least precision) to Double number.math-functionsMeasure distance between two DoubleEs in ULPs (units of least precision). Note that it's different from abs (ulpDelta a b), since it returns correct result even when  overflows.math-functions$Measure signed distance between two Double8s in ULPs (units of least precision). Note that unlike  it can overflow.  >>> ulpDelta 1 (1 + m_epsilon) 1math-functions Compare two ¸9 values for approximate equality, using Dawson's method.ŸThe required accuracy is specified in ULPs (units of least precision). If the two numbers differ by the given number of ULPs or less, this function returns True.math-functionseps( relative error should be in [0,1) rangemath-functionsamath-functionsbmath-functions#Number of ULPs of accuracy desired.(c) 2009, 2011 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableSafe*¾math-functions#Largest representable finite value. math-functions5The smallest representable positive normalized value. math-functions The largest ¹ x such that 2**(x)-1) is approximately representable as a ¸. math-functionsPositive infinity. math-functionsNegative infinity. math-functions Not a number.math-functions!Maximum possible finite value of log xmath-functions)Logarithm of smallest normalized double ( )math-functions sqrt 2math-functions  sqrt (2 * pi)math-functions  2 / sqrt pimath-functions  1 / sqrt 2math-functions The smallest ¸ µ such that 1 + µ "` 1.math-functions log(sqrt((2*pi))math-functions*Euler Mascheroni constant (³ = 0.57721...)  (c) 2012 Aleksey KhudyakovBSD3bos@serpentine.com experimentalportableNone6ùmath-functions[Evaluate polynomial using Horner's method. Coefficients starts from lowest. In pseudocode: 1evaluateOddPolynomial x [1,2,3] = 1 + 2*x + 3*x^2math-functionsqEvaluate polynomial with only even powers using Horner's method. Coefficients starts from lowest. In pseudocode: 3evaluateOddPolynomial x [1,2,3] = 1 + 2*x^2 + 3*x^4math-functionspEvaluate polynomial with only odd powers using Horner's method. Coefficients starts from lowest. In pseudocode: 5evaluateOddPolynomial x [1,2,3] = 1*x + 2*x^3 + 3*x^5math-functionsxmath-functions Coefficientsmath-functionsxmath-functions Coefficientsmath-functionsxmath-functions Coefficients(c) 2009, 2011 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNone<Aªmath-functionsNEvaluate a Chebyshev polynomial of the first kind. Uses Clenshaw's algorithm.math-functions§Evaluate a Chebyshev polynomial of the first kind. Uses Broucke's ECHEB algorithm, and his convention for coefficient handling. It treat 0th coefficient different so =chebyshev x [a0,a1,a2...] == chebyshevBroucke [2*a0,a1,a2...]math-functionsParameter of each function.math-functions:Coefficients of each polynomial term, in increasing order.math-functionsParameter of each function.math-functions:Coefficients of each polynomial term, in increasing order.0(c) 2011 Bryan O'Sullivan, 2018 Alexey KhudyakovBSD3bos@serpentine.com experimentalportableNone 13456FT€ú ºmath-functionsSteps for Newton iterations»math-functionsBNormal Newton-Raphson update. Parameters are: old guess, new guess¼math-functions`Bisection fallback when Newton-Raphson iteration doesn't work. Parameters are bracket on root½math-functions Root is found¾math-functionsRoot is not bracketedmath-functionsParameters for 3 root finding!math-functionsMaximum number of iterations."math-functions'Error tolerance for root approximation.¿math-functions+Single Ridders step. It's a bracket of rootÀmath-functions1Ridders step. Parameters are bracket for the rootÁmath-functions[Bisection step. It's fallback which is taken when Ridders update takes us out of bracketÂmath-functions Root foundÃmath-functionsRoot is not bracketed#math-functionsParameters for 3 root finding%math-functionsMaximum number of iterations.&math-functions'Error tolerance for root approximation.'math-functions<Type class for checking whether iteration converged already.(math-functionsReturn  Just rootL is current iteration converged within required error tolerance. Returns Nothing otherwise.)math-functionszError tolerance for finding root. It describes when root finding algorithm should stop trying to improve approximation.*math-functions Relative error tolerance. Given RelTol µ8 two values are considered approximately equal if 8 \frac{|a - b|}{|\operatorname{max}(a,b)} < \varepsilon +math-functions Absolute error tolerance. Given AbsTol ´5 two values are considered approximately equal if  |a - b| < \delta . Note that AbsTol 0L could be used to require to find approximation within machine precision.,math-functions>The result of searching for a root of a mathematical function.-math-functionsfThe function does not have opposite signs when evaluated at the lower and upper bounds of the search..math-functionshThe search failed to converge to within the given error tolerance after the given number of iterations./math-functionsA root was successfully found.0math-functions]Returns either the result of a search for a root, or the default value if the search failed.1math-functions¿Check that two values are approximately equal. In addition to specification values are considered equal if they're within 1ulp of precision. No further improvement could be done anyway.2math-functions%Find root in lazy list of iterations.3math-functionsÞUse the method of Ridders[Ridders1979] to compute a root of a function. It doesn't require derivative and provide quadratic convergence (number of significant digits grows quadratically with number of iterations).îThe function must have opposite signs when evaluated at the lower and upper bounds of the search (i.e. the root must be bracketed). If there's more that one root in the bracket iteration will converge to some root in the bracket.4math-functions,List of iterations for Ridders methods. See 3# for documentation of parameters5math-functions/Solve equation using Newton-Raphson iterations.ŽThis method require both initial guess and bounds for root. If Newton step takes us out of bounds on root function reverts to bisection.6math-functionsIList of iteration for Newton-Raphson algorithm. See documentation for 5 for meaning of parameters.0math-functionsDefault value.math-functionsResult of search for a root.2math-functionsMaximummath-functionsError tolerance3math-functionsParameters for algorithms. def provides reasonable defaultsmath-functionsBracket for rootmath-functionsFunction to find roots5math-functionsParameters for algorithm. def provide reasonable defaults.math-functions Triple of *(low bound, initial guess, upper bound)Y. If initial guess if out of bracket middle of bracket is taken as approximationmath-functionsZFunction to find root of. It returns pair of function value and its first derivative !"#$%&'()*+,/-.0123456,/-.0)*+1'(2#$%&34 !"56(c) 2016 Alexey KhudyakovBSD3-alexey.skladnoy@gmail.com, bos@serpentine.com experimentalportableSafeCV“Ç cmath-functionsGInfinite series. It's represented as opaque state and step function.emath-functionsenumSequenceFrom x generate sequence: a_n = x + n fmath-functionsenumSequenceFromStep x d generate sequence: a_n = x + nd gmath-functions Analog of Ä for sequence.hmath-functionsCalculate sum of series \sum_{i=0}^\infty a_i Summation is stopped when' a_{n+1} < \varepsilon\sum_{i=0}^n a_i where µ is machine precision ()imath-functionsCalculate sum of series \sum_{i=0}^\infty x^ia_i ECalculation is stopped when next value in series is less than µ·sum.jmath-functionsConvert series to infinite listkmath-functions€Evaluate continued fraction using modified Lentz algorithm. Sequence contain pairs (a[i],b[i]) which form following expression:B b_0 + \frac{a_1}{b_1+\frac{a_2}{b_2+\frac{a_3}{b_3 + \cdots}}} cModified Lentz algorithm is described in Numerical recipes 5.2 "Evaluation of Continued Fractions"lmath-functions%Elementwise operations with sequencesmmath-functions%Elementwise operations with sequences cdefghijk cdefghijk %(c) 2009, 2011, 2012 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNoneVÚTpmath-functionsError function.K \operatorname{erf}(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} \exp(-t^2) dt Function limits are:¦[ begin{aligned} &operatorname{erf}(-infty) &=& -1 -- &operatorname{erf}(0) &=& phantom{-},0 -- &operatorname{erf}(+infty) &=& phantom{-},1 -- end{aligned}qmath-functionsComplementary error function.6 \operatorname{erfc}(x) = 1 - \operatorname{erf}(x) Function limits are:’[ begin{aligned} &operatorname{erf}(-infty) &=&, 2 -- &operatorname{erf}(0) &=&, 1 -- &operatorname{erf}(+infty) &=&, 0 -- end{aligned}rmath-functions Inverse of p.smath-functions Inverse of q.tmath-functions/Compute the logarithm of the gamma function, “(x).; \Gamma(x) = \int_0^{\infty}t^{x-1}e^{-t}\,dt = (x - 1)! oThis implementation uses Lanczos approximation. It gives 14 or more significant decimal digits, except around x = 1 and x' = 2, where the function goes to zero.4Returns " if the input is outside of the range (0 < x "d 1e305).umath-functions Synonym for t. Retained for compatibilityvmath-functionsHCompute the log gamma correction factor for Stirling approximation for xl "e 10. This correction factor is suitable for an alternate (but less numerically accurate) definition of t:l \log\Gamma(x) = \frac{1}{2}\log(2\pi) + (x-\frac{1}{2})\log x - x + \operatorname{logGammaCorrection}(x) wmath-functions:Compute the normalized lower incomplete gamma function ³(z,x). Normalization means that ³(z,")=1@ \gamma(z,x) = \frac{1}{\Gamma(z)}\int_0^{x}t^{z-1}e^{-t}\,dt Uses Algorithm AS 239 by Shea.xmath-functionsDInverse incomplete gamma function. It's approximately inverse of w for the same z/. So following equality approximately holds: -invIncompleteGamma z . incompleteGamma z "H idymath-functions3Compute the natural logarithm of the beta function.U B(a,b) = \int_0^1 t^{a-1}(1-t)^{1-b}\,dt = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)} zmath-functions%Regularized incomplete beta function.? I(x;a,b) = \frac{1}{B(a,b)} \int_0^x t^{a-1}(1-t)^{1-b}\,dt YUses algorithm AS63 by Majumder and Bhattachrjee and quadrature approximation for large p and q.{math-functions.Regularized incomplete beta function. Same as z9 but also takes logarithm of beta function as parameter.|math-functions‹Compute inverse of regularized incomplete beta function. Uses initial approximation from AS109, AS64 and Halley method to solve equation.}math-functionsCompute sinc function sin(x)/x~math-functionsCompute log(1+x)-x:math-functionsO(log n)4 Compute the logarithm in base 2 of the given value.€math-functionsCompute the factorial function ne!. Returns +" if the input is above 170 (above which the result cannot be represented by a 64-bit ¸).math-functions`Compute the natural logarithm of the factorial function. Gives 16 decimal digits of precision.‚math-functionsgCalculate the error term of the Stirling approximation. This is only defined for non-negative values.Q \operatorname{stirlingError}(n) = \log(n!) - \log(\sqrt{2\pi n}\frac{n}{e}^n) ƒmath-functions)Quickly compute the natural logarithm of n † k, with no checking.Less numerically stable: Kexp $ lg (n+1) - lg (k+1) - lg (n-k+1) where lg = logGamma . fromIntegral„math-functions2Calculate binomial coefficient using exact formula…math-functions.Compute logarithm of the binomial coefficient.†math-functions!Compute the binomial coefficient n `†` k. For values of k‚ > 50, this uses an approximation for performance reasons. The approximation is accurate to 12 decimal places in the worst caseExample: 7 `choose` 3 == 35‡math-functions Compute È(x=), the first logarithmic derivative of the gamma function.T \psi(x) = \frac{d}{dx} \ln \left(\Gamma(x)\right) = \frac{\Gamma'(x)}{\Gamma(x)} EUses Algorithm AS 103 by Bernardo, based on Minka's C implementation.rmath-functionsp " [-1,1]smath-functionsp " [0,2]wmath-functionsz " (0,")math-functionsx " (0,")xmath-functionsz " (0,")math-functionsp " [0,1]ymath-functionsa > 0math-functionsb > 0zmath-functionsa > 0math-functionsb > 0math-functionsx, must lie in [0,1] range{math-functions%logarithm of beta function for given p and qmath-functionsa > 0math-functionsb > 0math-functionsx, must lie in [0,1] range|math-functionsa > 0math-functionsb > 0math-functionsx " [0,1]$ÅÆÇÈpqrstuvwxyz{ÉÊ|ËÌ}~€‚ƒ„…†‡ÍÎÏÐ(c) 2009, 2011 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNoneãgˆmath-functionsEvaluate the deviance term x log(x/np) + np - x.‰math-functions.Compute the logarithm of the gamma function “(x&). Uses Algorithm AS 245 by Macleod.XGives an accuracy of 10-12 significant decimal digits, except for small regions around x = 1 and xC = 2, where the function goes to zero. For greater accuracy, use  logGammaL.4Returns " if the input is outside of the range (0 < x "d 1e305).ˆmath-functions xmath-functions npvƒ„ˆ‰ˆ„ƒ‰v%(c) 2009, 2011, 2012 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNoneåpqrstuwxyz{|}~€‚…†‡pqrstuwx‡yz{|}~€‚†… (c) 2014 Bryan O'SullivanBSD3bos@serpentine.com experimentalportableNone 1<>?FT& Šmath-functions¹Kahan summation. This is the least accurate of the compensated summation methods. In practice, it only beats naive summation for inputs with large magnitude. Kahan summation can be less; accurate than naive summation for small-magnitude inputs._This summation method is included for completeness. Its use is not recommended. In practice, ”' is both 30% faster and more accurate.Œmath-functions0A class for summation of floating point numbers.math-functionsThe identity for summation.Žmath-functionsAdd a value to a sum.math-functionsSum a collection of values. Example: foo =  £ [1,2,3]”math-functionssKahan-Babuaka-Neumaier summation. This is a little more computationally costly than plain Kahan summation, but is always at least as accurate.–math-functions!Return the result of a Kahan sum.¡math-functionséSecond-order Kahan-Babuaka summation. This is more computationally costly than Kahan-Babuaka-Neumaier summation, running at about a third the speed. Its advantage is that it can lose less precision (in admittedly obscure cases).‡This method compensates for error in both the sum and the first-order compensation term, hence the use of "second order" in the name.£math-functions2Return the result of a Kahan-Babuaka-Neumaier sum.®math-functions2Return the result of an order-2 Kahan-Babuaka sum.¯math-functionsO(n) Sum a vector of values.°math-functionsO(n)1 Sum a vector of values using pairwise summation.)This approach is perhaps 10% faster than ”¹, but has poorer bounds on its error growth. Instead of having roughly constant error regardless of the size of the input vector, in the worst case its accumulated error grows with O(log n).Š‹ŒŽ”•–¡¢£®¯°ŒŽ¯”•£¡¢®Š‹–°Ñ  !"#$%&'()*+,,-.//01234567897:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmmnopqrstuvwx y z { | } ~  € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘’ “ “ ” • – — ˜ ™ š › œ œ ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½¾¿À¾¿ÁÂÂÃÄÅÆÆÇÈÉ ÊË Ì Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö×,math-functions-0.3.0.1-Fhyvh5r3dc3omtbvEgsu9Numeric.SpecFunctions Numeric.MathFunctions.ComparisonNumeric.MathFunctions.ConstantsNumeric.PolynomialNumeric.Polynomial.ChebyshevNumeric.RootFindingNumeric.SeriesNumeric.SpecFunctions.Extra Numeric.SumNumeric.SpecFunctions.Internalbase GHC.Floatexpm1log1p relativeErroreqRelErraddUlps ulpDistanceulpDeltawithinm_hugem_tiny m_max_exp m_pos_inf m_neg_infm_NaN m_max_log m_min_logm_sqrt_2 m_sqrt_2_pi m_2_sqrt_pi m_1_sqrt_2 m_epsilonm_ln_sqrt_2_pim_eulerMascheronievaluatePolynomialevaluateEvenPolynomialevaluateOddPolynomialevaluatePolynomialLevaluateEvenPolynomialLevaluateOddPolynomialL chebyshevchebyshevBroucke NewtonParam newtonMaxIter newtonTol RiddersParamriddersMaxIter riddersTol IterationStep matchRoot ToleranceRelTolAbsTolRoot NotBracketed SearchFailedfromRootwithinTolerancefindRootriddersriddersIterations newtonRaphsonnewtonRaphsonIterations$fAlternativeRoot$fMonadPlusRoot $fMonadRoot$fApplicativeRoot $fFunctorRoot $fNFDataRoot$fDefaultRiddersParam$fIterationStepRiddersStep$fNFDataRiddersStep$fDefaultNewtonParam$fIterationStepNewtonStep$fNFDataNewtonStep$fEqRoot $fReadRoot $fShowRoot $fDataRoot$fFoldableRoot$fTraversableRoot $fGenericRoot $fEqTolerance$fReadTolerance$fShowTolerance$fDataTolerance$fGenericTolerance$fEqRiddersParam$fReadRiddersParam$fShowRiddersParam$fDataRiddersParam$fGenericRiddersParam$fEqRiddersStep$fReadRiddersStep$fShowRiddersStep$fDataRiddersStep$fGenericRiddersStep$fEqNewtonParam$fReadNewtonParam$fShowNewtonParam$fDataNewtonParam$fGenericNewtonParam$fEqNewtonStep$fReadNewtonStep$fShowNewtonStep$fDataNewtonStep$fGenericNewtonStepSequenceenumSequenceFromenumSequenceFromStep scanSequence sumSeriessumPowerSeriessequenceToListevalContFractionB$fFractionalSequence $fNumSequence$fApplicativeSequence$fFunctorSequenceerferfcinvErfinvErfclogGamma logGammaLlogGammaCorrectionincompleteGammainvIncompleteGammalogBetaincompleteBetaincompleteBeta_invIncompleteBetasinclog1pmxlog2 factorial logFactorial stirlingError logChooseFast chooseExact logChoosechoosedigammabd0 logGammaAS245KahanSum Summationzeroaddsum$fSummationDouble $fEqKahanSum$fShowKahanSum$fDataKahanSumKBNSumkahan$fSemigroupKahanSum$fMonoidKahanSum$fNFDataKahanSum$fSummationKahanSum$fVectorVectorKahanSum$fMVectorMVectorKahanSum$fUnboxKahanSum $fEqKBNSum $fShowKBNSum $fDataKBNSumKB2Sumkbn$fSemigroupKBNSum$fMonoidKBNSum$fNFDataKBNSum$fSummationKBNSum$fVectorVectorKBNSum$fMVectorMVectorKBNSum $fUnboxKBNSum $fEqKB2Sum $fShowKB2Sum $fDataKB2Sumkb2 sumVector pairwiseSum$fSemigroupKB2Sum$fMonoidKB2Sum$fNFDataKB2Sum$fSummationKB2Sum$fVectorVectorKB2Sum$fMVectorMVectorKB2Sum $fUnboxKB2Sumghc-prim GHC.TypesDoubleInt NewtonStepNewtonBisection NewtonRootNewtonNoBracket RiddersStep RiddersBisect RiddersRootRiddersNoBracketGHC.ListscanlLc_erfcc_erfincompleteBetaApproxincompleteBetaWorkerinvIncompleteBetaWorkerinvIncBetaGuesscoefWcoefY trigamma1modErr