polynomial-algebra-0.1.0.1: Multivariate polynomial rings

Safe HaskellSafe
LanguageHaskell2010

Math.Algebra.Polynomial.Misc

Contents

Description

Some auxilary functions used internally

Synopsis

Documentation

equating :: Eq b => (a -> b) -> a -> a -> Bool Source #

Lists

unique :: Ord a => [a] -> [a] Source #

count :: Ord b => [b] -> Map b Integer Source #

Synonym for histogram

histogram :: Ord b => [b] -> Map b Integer Source #

sum' :: Num a => [a] -> a Source #

longZipWith :: (a -> c) -> (b -> c) -> (a -> b -> c) -> [a] -> [b] -> [c] Source #

longReplaceListElem :: a -> Int -> a -> [a] -> [a] Source #

Maps

deleteLookup :: Ord a => a -> Map a b -> (Maybe b, Map a b) Source #

unsafeDeleteLookup :: Ord a => a -> Map a b -> (b, Map a b) Source #

insertMap :: Ord k => (b -> a) -> (b -> a -> a) -> k -> b -> Map k a -> Map k a Source #

Example usage: insertMap (:[]) (:) ...

buildMap :: Ord k => (b -> a) -> (b -> a -> a) -> [(k, b)] -> Map k a Source #

Example usage: buildMap (:[]) (:) ...

Signs

data Sign Source #

Constructors

Plus 
Minus 
Instances
Eq Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

(==) :: Sign -> Sign -> Bool #

(/=) :: Sign -> Sign -> Bool #

Ord Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

compare :: Sign -> Sign -> Ordering #

(<) :: Sign -> Sign -> Bool #

(<=) :: Sign -> Sign -> Bool #

(>) :: Sign -> Sign -> Bool #

(>=) :: Sign -> Sign -> Bool #

max :: Sign -> Sign -> Sign #

min :: Sign -> Sign -> Sign #

Read Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Show Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

showsPrec :: Int -> Sign -> ShowS #

show :: Sign -> String #

showList :: [Sign] -> ShowS #

Semigroup Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

(<>) :: Sign -> Sign -> Sign #

sconcat :: NonEmpty Sign -> Sign #

stimes :: Integral b => b -> Sign -> Sign #

Monoid Sign Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

mempty :: Sign #

mappend :: Sign -> Sign -> Sign #

mconcat :: [Sign] -> Sign #

negateIfOdd :: (Integral a, Num b) => a -> b -> b Source #

Negate the second argument if the first is odd

signValue :: Num a => Sign -> a Source #

+1 or -1

signed :: Num a => Sign -> a -> a Source #

Negate the second argument if the first is Minus

class IsSigned a where Source #

Methods

signOf :: a -> Maybe Sign Source #

Instances
IsSigned Int Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

Methods

signOf :: Int -> Maybe Sign Source #

IsSigned Integer Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

IsSigned Rational Source # 
Instance details

Defined in Math.Algebra.Polynomial.Misc

IsSigned (Poly c v) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Multivariate.Infinite

Methods

signOf :: Poly c v -> Maybe Sign Source #

IsSigned (Poly c v) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Multivariate.Generic

Methods

signOf :: Poly c v -> Maybe Sign Source #

IsSigned (Univariate c v) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Univariate

Methods

signOf :: Univariate c v -> Maybe Sign Source #

IsSigned (Poly c v n) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Multivariate.Indexed

Methods

signOf :: Poly c v n -> Maybe Sign Source #

IsSigned (Poly c v n) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Multivariate.Compact

Methods

signOf :: Poly c v n -> Maybe Sign Source #

IsSigned (ExtAlg c v n) Source # 
Instance details

Defined in Math.Algebra.Polynomial.Exterior.Indexed

Methods

signOf :: ExtAlg c v n -> Maybe Sign Source #

signOfNum :: (Ord a, Num a) => a -> Maybe Sign Source #

Numbers

Basic number theory

factorial :: Integral a => a -> Integer Source #

A000142.

binomial :: Integral a => a -> a -> Integer Source #

A007318. Note: This is zero for n<0 or k<0; see also signedBinomial below.

moebiusMu :: Num c => Int -> c Source #

squareFreeDivisors :: Int -> [(Int, Sign)] Source #

Square-free divisors together with their Mobius mu value

primes :: [Integer] Source #

List of primes, using tree merge with wheel. Code by Will Ness.

groupIntegerFactors :: [Integer] -> [(Integer, Int)] Source #

Groups integer factors. Example: from [2,2,2,3,3,5] we produce [(2,3),(3,2),(5,1)]

integerFactorsTrialDivision :: Integer -> [Integer] Source #

The naive trial division algorithm.

Basic combinatorics

tuples' :: [Int] -> [[Int]] Source #

sublists :: [a] -> [[a]] Source #

All sublists of a list.

Integer-indexed cache

intCache :: ((Int -> a) -> Int -> a) -> Int -> a Source #

newtype ITable a Source #

Constructors

ITable [Array Int a] 

mkITable :: [a] -> ITable a Source #

lkpITable :: Int -> ITable a -> a Source #

Stirling numbers

signedStirling1stArray :: Integral a => a -> Array Int Integer Source #

Rows of (signed) Stirling numbers of the first kind. OEIS:A008275. Coefficients of the polinomial (x-1)*(x-2)*...*(x-n+1). This function uses the recursion formula.

stirling2nd :: Integral a => a -> a -> Integer Source #

Stirling numbers of the second kind. OEIS:A008277. This function uses an explicit formula.

Argument order: stirling2nd n k