q      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop A commutative  4 in which all non-zero elements have multiplicative  inverses. Minimal complete definition:  or (). Multiplicative inverse. -A integral domain (a non-trivial commutative   with no zero  divisors) on which the Euclid's algorithm for  works. Minimal complete definition:  (  or ( and  )) and  . !Division with remainder: for any d /= 0,  n ==  n d * d +   n d   (n + a*d) d ==   n d   n d is smaller than d in some well-founded order. For integral types,   n d# is a non-negative integer smaller  than the absolute value of d. !Division with remainder: for any d /= 0,  n ==  n d * d +   n d   (n + a*d) d ==   n d   n d is smaller than d in some well-founded order. For integral types,   n d# is a non-negative integer smaller  than the absolute value of d.    n d == ( n d,   n d)  For each n there is a decomposition n ==   n *   n  such that   n" has a multiplicative inverse and    (  n) ==   (  n) == 1For integral types,   d is a non-negative integer and  than   d is -1 or 1.  For each n there is a decomposition n ==   n *   n  such that   n" has a multiplicative inverse and    (  n) ==   (  n) == 1For integral types,   d is a non-negative integer and  than   d is -1 or 1. DA ring: addition forms an Abelian group, and multiplication defines ) a monoid and distributes over addition. 5 Multiplication is not guaranteed to be commutative. Minimal complete definition: () and . 'An associative operation with identity  1,  distributing over () and . Conversion from q, the initial ring:  # is the unique function preserving , (),  () and (), and for which  1 is the  identity of (). >An integer literal represents the application of the function  " to the appropriate value of type q,  so such literals have type (  a) => a. AAn Abelian group has an commutative associative binary operation  with an identity and inverses. Minimal complete definition: , () and (() or ). The identity of (). 2A commutative associative operation with identity zero. 2A commutative associative operation with identity zero.  Inverse for () (unary negation).  The same as r (). Because -. is treated specially in the Haskell grammar,  (- e): is not a section, but an application of prefix negation.  However, ( exp)* is equivalent to the disallowed section.  x y is a common factor of x and y such that    ( x y) ==  x y, and  any common factor of x and y is a factor of  x y.  x y is a common multiple of x and y such that    ( x y) ==  x y, and  any common multiple of x and y is a multiple of  x y. :Forms the ratio of two values in a Euclidean domain (e.g. q). 4Extract the numerator of the ratio in reduced form: I the numerator and denominator have no common factor and the denominator  is positive. 6Extract the denominator of the ratio in reduced form: I the numerator and denominator have no common factor and the denominator  is positive. stDirect product uDirect product v s  s :unchanged from Haskell 98  !"#$%&'()*unchanged from Haskell 98 +,-./0unchanged from Haskell 98 123456789:;<=>?@ABCHaskell 98 compatibility class D Convert from  ?A floating point numeric literal represents the application of  the function D" to the appropriate value of type  , so such literals have type ( a) => a. E/Integral numbers, supporting integer division. Minimal complete definition: I. F'Integer division truncated toward zero GInteger remainder, satisfying # (x `quot` y)*y + (x `rem` y) == x H simultaneous F and G IConversion to q Junchanged from Haskell 98 KAThe rational equivalent of its real argument with full precision LHaskell 98 compatibility class MAbsolute value. NSign of a number.  The functions M and N should satisfy the law:   abs x * signum x == x For real numbers, the N is either -1 (negative), 0 (zero)  or 1 (positive). OPQ0raise a number to a non-negative integral power R$raise a number to an integral power S0General conversion from integral types, via the q type. T&General conversion to fields, via the  type. : !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST: !"#$%&'() !"#$%&'()*+,-./+,-./0123456789:;<=>?@AB123456789:;<=>?@ABCDDEFGHIFGHIJKKLMNMNOPQRSTportable provisionalross@soi.city.ac.uk   portable provisionalross@soi.city.ac.ukwxyz{|}~qr       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST:LMNJKCDEFGHI*+,-./0123456789:;<=>?@AB !"#$%&'()OPQRSTportablestablelibraries@haskell.orgUU), applied to two real fractional numbers x and epsilon, - returns the simplest rational number within epsilon of x.  A rational number y is said to be simpler than another y' if  M ( y) <= M ( y'), and   y <=  y'. 7Any real interval contains a unique simplest rational;  in particular, note that 0/1" is the simplest rational of all. UUUportable provisionallibraries@haskell.org V,Extracts the real part of a complex number. W1Extracts the imaginary part of a complex number. X#The conjugate of a complex number. YDForm a complex number from polar components of magnitude and phase. ZZ t# is a complex value with magnitude 1  and phase t (modulo 2*1). [ The function [ takes a complex number and 6 returns a (magnitude, phase) pair in canonical form: : the magnitude is nonnegative, and the phase in the range (-1, 1]; 1 if the magnitude is zero, then so is the phase. \/The nonnegative magnitude of a complex number. < is used to do scaling to reduce the incidence of overflow. ],The phase of a complex number, in the range (-1, 1]. 1 If the magnitude is zero, then so is the phase.  is need for ). < is used to do scaling to reduce the incidence of overflow. Gaussian integers:  if b. is non-zero, the norm (squared magnitude) of   a b  is at most half that of b. 3 Standard associates lie in the positive quadrant. VWXYZ[\] VWYZ[\]XVWXYZ[\]portable provisionalross@soi.city.ac.uk^Simple vector type. _`Dot product of two vectors. aNorm of a vector. ^_`a^_`a^__`aportable provisionalross@soi.city.ac.ukbc list of rows dMultiply a matrix by a vector. bcdbcdbccdportable provisionalross@soi.city.ac.uke !"#$f4Construct a polynomial from a list of coefficients,  least significant first. gAThe coefficients of a finite polynomial, least significant first  and with no trailing zeroes. %@The coefficients of a finite polynomial, starting with the most # significant non-zero coefficient. h#The degree of a finite polynomial. h p = length (coefficients p)i+Evaluate a polynomial for a given value of x.  i a x =  (*) (g a) ( (*x) 1)(The implementation uses Horner' s rule.) jBThe infinite list of evaluations of truncations of the polynomial  or power series. k Pretty-print a polynomial, e.g. !pretty (polynomial [3, 4, 0, 1, 5]) "x" = "5x^4 + x^3 + 4x + 3"lComposition of polynomials: i (l a b) = i a . i b&m)Symbolic differentiation of polynomials. n%Symbolic integration of polynomials. 'If b is non-zero,   a b has a smaller degree than b.  If a is non-zero,   a has a leading coefficient of 1. efghijklmn efghikjlmn efghijklmnportable provisionalross@soi.city.ac.ukoQuantities of a numeric type a", in units encoded by the phantom  type parameter u. G For example, types for counting apples and oranges can be defined as:    data Apple  data Orange " type Apples = Quantity Apple Int $ type Oranges = Quantity Orange Int You can' t compare Apples with Oranges (or add them).  You can add Apples to Apples, but not multiply them. AA full dimensional system keeping track of units while modelling @ multiplication and division will require type-level functions. popopopp(                   ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a bcdefghijkllmnoopqrstuvwxyz{{|}~                                                             ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9:;<=>?@?ABCDEFGHIJyap-0.1Data.YAP.RatioData.YAP.ComplexData.YAP.Algebra Prelude.YAPData.YAP.VectorData.YAP.MatrixData.YAP.PolynomialData.YAP.QuantityData.YAP.Algebra.InternalPrelude.YAP.InternalbaseGHC.RealRatioRational Data.Complex:+ComplexField/recipEuclideanDomaindivmoddivMod associateunitRing* fromInteger AbelianGroupzero+-negatesubtractgcdlcm% numerator denominator RealFloat floatRadix floatDigits floatRange decodeFloat encodeFloatexponent significand scaleFloatisNaNisIEEEisNegativeZeroisDenormalized isInfiniteatan2RealFracproperFractiontruncateroundceilingfloorFloatingpiexpsqrtlog**logBasesintancosasinatanacossinhtanhcoshasinhatanhacosh Fractional fromRationalIntegralquotremquotRem toIntegerReal toRationalNumabssignumevenodd^^^ fromIntegral realToFracapproxRationalrealPartimagPart conjugatemkPolarcispolar magnitudephaseVectordotnormMatrixapply Polynomial polynomial coefficientsdegreeevaluateapproximationsprettycompose differentiate integrateQuantity integer-gmpGHC.Integer.TypeIntegerGHC.Baseflip ifThenElse $fRing(,)$fAbelianGroup(,):%++GHC.Errerrorfoldrghc-primGHC.PrimseqGHC.Listconcatfilterzip System.IOprint Data.Tuplefstsnd otherwisemap$GHC.EnumenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classes==>=fail>>=>>fmapreturnBoundedEnumEqMonadFunctorOrdGHC.ReadReadGHC.ShowShow GHC.TypesBoolCharDoubleFloatInt GHC.OrderingOrderingIO Data.EitherEitherStringFalseTrueLeftRightPrelude$!readIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputCharSystem.IO.ErrorcatchGHC.IO.ExceptionioError Text.Readreadreadseither Data.Listunwordswordsunlineslinesproductsumfoldl1minimummaximumlex readParenreadList readsPrecText.ParserCombinators.ReadPReadSGHC.IOFilePath userErrorIOError undefined Control.MonadmapM_mapM sequence_sequence=<< showParen showStringshowCharshowsShowSshowListshow showsPrecunzip3unzipzipWith3zipWithzip3!! concatMaplookupnotElemelemallanyorandreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiteratescanr1scanrfoldr1scanl1scanlfoldllengthnullinitlasttailhead Data.MaybemaybeNothingJustMaybemaxBoundminBoundfromEnumtoEnumpredsuccuncurrycurryasTypeOfuntil.constidnot||&&/=minmax<=><compareGTEQLT$fFieldComplex$fEuclideanDomainComplexsum'diagonalPallZeroaddmul divModAuxsubrev_coefficientsconstant$fEuclideanDomainPolynomial