Difference between revisions of "Applications and libraries/Mathematics"
(new section for discrete math, added Matroid) 
(Add link to the current place of Frederik Eaton's library) 

(76 intermediate revisions by 34 users not shown)  
Line 1:  Line 1:  
−  {{unknown copyright}} 

+  == Applications == 

−  {{LibrariesPage}} 

−  == Libraries for numerical algorithms and mathematics == 

+  === Physics === 

+  
+  ;[http://abinitio.mit.edu/meep/ Meep] 

+  :Meep (or MEEP) is a free finitedifference timedomain (FDTD) simulation software package developed at MIT to model electromagnetic systems. Meep used Haskell to generate C++ code, after Meep [http://abinitio.mit.edu/wiki/index.php/Meep_release_notes 1.0] Haskell generation droped in favor of handwritten C++ code. 

+  
+  ;[[Numeric Quest]] 

+  :Jan Skibinski's [[Numeric Quest]] library provides modules that are useful for Quantum Mechanics, among other things. 

+  
+  == Libraries == 

=== Linear algebra === 
=== Linear algebra === 

−  ;[http://dis.um.es/~alberto/GSLHaskell GSLHaskell] 

+  ;[http://hackage.haskell.org/package/bedandbreakfast bedandbreakfast] 

−  :High level functional interface to standard linear algebra computations and other numerical algorithms based on the GNU Scientific Library. [http://alberrto.googlepages.com/gslhaskell Alternative download site]. 

+  :A library that implements Matrix operations in pure Haskell using mutable arrays and the ST Monad. bedandbreakfast does not need any additional software to be installed and can perform basic matrix operations like multiplication, finding the inverse, and calculating determinants efficiently. 

+  
+  ;[https://github.com/patperry/hslinearalgebra hslinearalgebra] 

+  :Patrick Perry's linear algebra library, built on BLAS. [https://github.com/cartazio/hscblas hscblas] seems to be a more uptodate fork. 

;[http://www.cs.utah.edu/~hal/HBlas/index.html Wrapper to CLAPACK] 
;[http://www.cs.utah.edu/~hal/HBlas/index.html Wrapper to CLAPACK] 

;[http://haskelldsp.sourceforge.net/ Digital Signal Processing] 
;[http://haskelldsp.sourceforge.net/ Digital Signal Processing] 

−  :Modules for matrix manipulation, 
+  :Modules for matrix manipulation, Fourier transform, interpolation, spectral estimation, and frequency estimation. 
−  ;[ 
+  ;[https://ofb.net/~frederik/vectro/ Indexaware linear algebra] ([http://archive.fo/bfres original announcment]) 
:Frederik Eaton's library for statically checked matrix manipulation in Haskell 
:Frederik Eaton's library for statically checked matrix manipulation in Haskell 

−  ;[http://cvs.haskell.org/darcs/numericquest/Orthogonals.html Indexless linear algebra] 

+  ;[[Numeric Quest]] 

−  :algorithms by Jan Skibinski, see below 

+  :Jan Skibinski's [[Numeric Quest]] library provides several modules that are useful for linear algebra in general, among other things. 

+  
+  ;[[vectorspace]] 

+  :The [[vectorspace]] package defines classes and generic operations for vector spaces and affine spaces. It also defines a type of infinite towers of generalized derivatives (linear transformations). 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/hmatrix HMatrix] 

+  :By Alberto Ruiz. From the project [http://perception.inf.um.es/hmatrix/ website]: 

+  ::''A purely functional interface to linear algebra and other numerical algorithms, internally implemented using LAPACK, BLAS, and GSL. 

+  
+  ::''This package includes standard matrix decompositions (eigensystems, singular values, Cholesky, QR, etc.), linear systems, numeric integration, root finding, etc. 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/Vec Vec] 

+  :By Scott E. Dillard. Static dimension checking: 

+  ::''Vectors are represented by lists with typeencoded lengths. The constructor is :., which acts like a cons both at the value and type levels, with () taking the place of nil. So x:.y:.z:.() is a 3d vector. The library provides a set of common listlike functions (map, fold, etc) for working with vectors. Built up from these functions are a small but useful set of linear algebra operations: matrix multiplication, determinants, solving linear systems, inverting matrices.'' 

+  
+  ;[https://github.com/martinra/hlinear HLinear] 

+  :By Alexandru Ghitza, Martin WesterholtRaum. PDE decomposition of matrices over division rings. See [https://arxiv.org/abs/1605.02532 HLinear: Exact Dense Linear Algebra in Haskell]. 

+  ::''HLinear is a Haskell implementation of the PLE decomposition of matrices over division rings. It writes an arbitrary matrix as a product of a permutation matrix, a lower unitriangular matrix, and an echelon matrix.'' 

+  
+  == See also == 

+  
+  * [[Linear algebra]] 

+  * [[Mathematical prelude discussion]] 

+  
See also: [[Linear algebraDesign discussions]] 
See also: [[Linear algebraDesign discussions]] 

+  
+  === [[Physical units]] === 

+  
+  ;[[Dimensionalized numbers]] 

+  : Working with physical units like second, meter and so on in a typesafe manner. 

+  
+  ;[http://darcs.haskell.org/numericprelude/src/Number/SI.hs NumericPrelude: Physical units] 

+  : Numeric values with dynamically checked units. 

+  
+  ;[[CalDims]] 

+  :This is not simply a library providing a new type of <hask>Num</hask> class, but standalone calculation tool that supports user defined functions and units (basic and derived), so it can provide dimensionsafe calculation (not embedded but via shell). Calculations can be modified/saved via shell. It uses rational numbers to avoid rounding errors where possible. 

+  
+  ;[https://github.com/bjornbm/dimensional Dimensional] 

+  : Library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division of units. 

=== Number representations === 
=== Number representations === 

−  ;[http://www.nheptane.com/nhlab/repos/Decimal Decimal arithmetic library] 

+  ==== Decimal numbers ==== 

+  
+  ;[http://src.seereason.com/decimal/ Decimal arithmetic library] 

:An implementation of real decimal arithmetic, for cases where the binary floating point is not acceptable (for example, money). 
:An implementation of real decimal arithmetic, for cases where the binary floating point is not acceptable (for example, money). 

+  ==== Real and rational numbers ==== 

There are several levels of [[Exact real arithmetichandling real numbers]] and according libraries. 
There are several levels of [[Exact real arithmetichandling real numbers]] and according libraries. 

−  ==== Arbitrary precision ==== 
+  ===== Arbitrary precision ===== 
−  +  * Numbers have fixed precision 

+  * Rounding errors accumulate 

+  * Sharing is easy, i.e. in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> is computed only once 

+  * Fast, because the routines can make use of the fast implementation of <hask>Integer</hask> operations 

−  ;[http://cvs.haskell.org/darcs/numericquest/Fraction.hs Fractions.hs] 

+  ;[[Numeric Quest]] 

−  :algorithms by Jan Skibinski, see below 

+  :Jan Skibinski's [[Numeric Quest]] library provides, among other things, a type for arbitrary precision rational numbers with transcendental functions. 

;[http://cvs.haskell.org/darcs/numericprelude/src/Number/FixedPoint.hs FixedPoint.hs] 
;[http://cvs.haskell.org/darcs/numericprelude/src/Number/FixedPoint.hs FixedPoint.hs] 

:part of NumericPrelude project 
:part of NumericPrelude project 

−  ==== Dynamic precision ==== 

+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/AERNBasics AERNBasics] [http://hackage.haskell.org/cgibin/hackagescripts/package/AERNReal AERNReal] [http://hackage.haskell.org/cgibin/hackagescripts/package/AERNRealInterval AERNRealInterval] [http://hackage.haskell.org/cgibin/hackagescripts/package/AERNRealDouble AERNRealDouble] 

+  :contains type classes that form a foundation for ''rounded arithmetic'' and ''interval arithmetic'' with explicit control of rounding and the possibility to increase the rounding precision arbitrarily for types that support it. At the moment there are instances for Double floating point numbers where one can control the direction of rounding but cannot increase the rounding precision. In the near future instances for MPFR arbitrary precision numbers will be provided. Intervals can use as endpoints any type that supports directed rounding in the numerical order (such as Double or MPFR) and operations on intervals are rounded either outwards or inwards. Outwards rounding allows to safely approximate exact real arithmetic while a combination of both outwards and inwards rounding allows one to safely approximate exact interval arithmetic. Inverted intervals with Kaucher arithmetic are also supported. 

−  You tell the precision, an expression shall be computed to 

+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/AERNRnToRm AERNRnToRm] 

−  and the computer finds out, how precise to compute the input values. 

+  :contains arithmetic of ''piecewise polynomial function intervals'' that approximate multidimensional (almost everywhere) continuous real functions to arbitrary precision 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/hmpfr hmpfr] 

+  :hmpfr is a purely functional haskell interface to the [http://www.mpfr.org/ MPFR] library 

+  
+  ;[http://hackage.haskell.org/package/numbers numbers] 

+  :provides an uptodate, easytouse BigFloat implementation that builds with a modern GHC, among other things. 

+  
+  ===== Dynamic precision ===== 

+  
+  * You tell the precision and an expression shall be computed to, and the computer finds out, how precisely to compute the input values 

+  * Rounding errors do not accumulate 

+  * Sharing of temporary results is difficult, that is, in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> ''will'' be computed twice, each time with the required precision. 

+  * Almost as fast as arbitrary precision computation 

;[http://www.cs.man.ac.uk/arch/dlester/exact.html ERA] is an implementation (in Haskell 1.2) by David Lester. 
;[http://www.cs.man.ac.uk/arch/dlester/exact.html ERA] is an implementation (in Haskell 1.2) by David Lester. 

−  :It is quite fast, possibly the fastest Haskell implementation. At 220 lines it is also the shortest. Probably the shortest implementation of exact real arithmetic in any language. 
+  : It is quite fast, possibly the fastest Haskell implementation. At 220 lines it is also the shortest. Probably the shortest implementation of exact real arithmetic in any language. 
+  : The provided number type <hask>CReal</hask> is instance of the Haskell 98 numeric type classes and thus can be used whereever you used Float or Double before and encountered some numerical difficulties. 

:Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/ 
:Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/ 

Line 62:  Line 126:  
:The work is in beta and relies on new primitive operations on Integers which will be implemented in GHC. The library isn't available yet. 
:The work is in beta and relies on new primitive operations on Integers which will be implemented in GHC. The library isn't available yet. 

−  ==== Lazily evaluated ==== 

+  ;[http://www2.arnes.si/~abizja4/hera/ Hera] is an implementation by Aleš Bizjak. 

+  :It uses the [http://www.mpfr.org/ MPFR] library to implement dyadic rationals, on top of which are implemented intervals and real numbers. A real number is represented as a function <hask>Int > Interval</hask> which represents a sequence of intervals converging to the real. 

+  
+  ===== Dynamic precision by lazy evaluation ===== 

The real numbers are represented by an infinite datastructure, which allows you to increase precision successively by evaluating the data structure successively. All of the implementations below use some kind of digit stream as number representation. 
The real numbers are represented by an infinite datastructure, which allows you to increase precision successively by evaluating the data structure successively. All of the implementations below use some kind of digit stream as number representation. 

+  Sharing of results is simple. 

+  The implementations are either fast on simple expressions, because they use large blocks/bases, or they are fast on complex expressions, because they consume as little as possible input digits in order to emit the required output digits. 

;[http://medialab.freaknet.org/bignum/ BigFloat] is an implementation by Martin Guy. 
;[http://medialab.freaknet.org/bignum/ BigFloat] is an implementation by Martin Guy. 

Line 72:  Line 141:  
;[http://darcs.haskell.org/numericprelude/src/Number/Positional.hs NumericPrelude: positional numbers] 
;[http://darcs.haskell.org/numericprelude/src/Number/Positional.hs NumericPrelude: positional numbers] 

−  :Represents a real number as pair <hask>(exponent,[digit])</hask>, 

+  :Represents a real number as pair <hask>(exponent,[digit])</hask>, where the digits are <hask>Int</hask>s in the open range <hask>(basis,basis)</hask>. There is no need for an extra sign item in the number data structure. The <hask>basis</hask> can range from <hask>10</hask> to <hask>1000</hask>. (Binary representations can be derived from the hexadecimal representation.) Showing the numbers in traditional format (nonnegative digits) fails for fractions ending with a run of zeros. However the internal representation with negative digits can always be shown and is probably more useful for further processing. An interface for the numeric type hierarchy of the NumericPrelude project is provided. 

−  :where the digits are <hask>Int</hask>s in the open range <hask>(basis,basis)</hask>. 

−  :There is no need for an extra sign item in the number data structure. 

−  :The <hask>basis</hask> can range from <hask>10</hask> to <hask>1000</hask>. 

−  :(Binary representations can be derived from the hexadecimal representation.) 

−  :Showing the numbers in traditional format (nonnegative digits) 

−  :fails for fractions ending with a run of zeros. 

−  :However the internal representation with negative digits can always be shown 

−  :and is probably more useful for further processing. 

−  :An interface for the numeric type hierarchy of the NumericPrelude project is provided. 

−  
:It features 
:It features 

:* basis conversion 
:* basis conversion 

Line 88:  Line 147:  
:* algebraic arithmetic: square root, other roots (no general polynomial roots) 
:* algebraic arithmetic: square root, other roots (no general polynomial roots) 

:* transcendental arithmetic: pi, exponential, logarithm, trigonometric and inverse trigonometric functions 
:* transcendental arithmetic: pi, exponential, logarithm, trigonometric and inverse trigonometric functions 

−  
=== Type class hierarchies === 
=== Type class hierarchies === 

−  There are several approaches to improve the numeric type class hierarchy. 
+  There are several approaches to improve the [[Mathematical prelude discussionnumeric type class hierarchy]]. 
−  ;Dylan Thurston and Henning Thielemann's [ 
+  ;Dylan Thurston and Henning Thielemann's [[Numeric Prelude]] 
:Experimental revised framework for numeric type classes. Needs hiding of Prelude, overriding hidden functions like fromInteger and multiparameter type classes. Probably restricted to GHC. 
:Experimental revised framework for numeric type classes. Needs hiding of Prelude, overriding hidden functions like fromInteger and multiparameter type classes. Probably restricted to GHC. 

Line 104:  Line 162:  
:The proposal: ftp://ftp.geoinfo.tuwien.ac.at/frank/numbersPrelude_v1.pdf 
:The proposal: ftp://ftp.geoinfo.tuwien.ac.at/frank/numbersPrelude_v1.pdf 

−  ;Haskell Prime: [http:// 
+  ;Haskell Prime: [http://prime.haskell.org/ticket/112 Ongoing efforts for the language revision] 
=== Discrete mathematics === 
=== Discrete mathematics === 

Line 117:  Line 175:  
:is a book by [http://wwwopt.mathematik.tudarmstadt.de/~bokowski/ Jürgen G. Bokowski], where he develops Haskell code for Matroid computations. 
:is a book by [http://wwwopt.mathematik.tudarmstadt.de/~bokowski/ Jürgen G. Bokowski], where he develops Haskell code for Matroid computations. 

−  === other === 

+  See also [[Libraries and tools/Cryptography]] 

−  ;[http://www.dinkla.net/fp/cglib.html Geometric Algorithms] 

+  === Computer Algebra === 

−  :A small Haskell library, containing algorithms for twodimensional convex hulls, triangulations of polygons, Voronoidiagrams and Delaunaytriangulations, the QEDS data structure, kdtrees and rangetrees. 

+  
+  <! Older link: http://haskell.org/docon/ > 

+  ; [http://homepages.inf.ed.ac.uk/wadler/realworld/docon2.html DoCon], the Algebraic Domain Constructor 

+  : A library by Sergey D. Mechveliani for Algebra, turns GHCi into a kind of Computer Algebra System 

;[http://www.info.unicaen.fr/~karczma/arpap/ Papers by Jerzy Karczmarczuk] 
;[http://www.info.unicaen.fr/~karczma/arpap/ Papers by Jerzy Karczmarczuk] 

−  :Some interesting uses of Haskell in mathematics, including functional differentiation, power series, continued fractions. 
+  :Some interesting uses of Haskell in mathematics, including [[functional differentiation]], power series, continued fractions. 
−  ;[http://haskell.org/docon/ DoCon]  Algebraic Domain Constructor 

+  ;[http://www.robtougher.com/HCAS/ HCAS] by Rob Tougher. 

−  :A Computer Algebra System 

+  
+  === Statistics === 

+  ;[http://hackage.haskell.org/package/hstats hstats] 

+  : Statistical Computing with Haskell 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/hmatrixgslstats hmatrixgslstats] 

+  : A binding to the statistics portion of GSL. Works with hmatrix 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/hstatistics hstatistics] 

+  : A library for doing statistics. Works with hmatrix 

+  
+  === Plotting === 

+  
+  ;[http://hackage.haskell.org/package/easyplot easyplot] 

+  : Simple and easy wrapper to gnuplot. 

+  
+  ;[[Gnuplot]] 

+  : Simple wrapper to gnuplot 

+  
+  ;[http://hackage.haskell.org/packages/archive/hmatrix/latest/doc/html/GraphicsPlot.html hmatrix] 

+  : contains a deprecated gnuplot wrapper 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/Chart Chart] 

+  : A library for generating 2D Charts and Plots, based upon the cairo graphics library. 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/plot plot] 

+  : A library for generating figures, based upon the cairo graphics libary with 

+  a simple, monadic interface. 

+  
+  ;[http://hackage.haskell.org/cgibin/hackagescripts/package/probability probability] 

+  : the module Numeric.Probability.Visualize contains a wrapper to [http://www.rproject.org/ R] 

+  
+  ;[https://github.com/abarbu/matplotlibhaskell matplotlibhaskell] 

+  : Haskell bindings for Python's Matplotlib 

+  
+  ;[https://github.com/ocramz/bokehhs bokehhs] 

+  : Haskell bindings for Bokeh 

+  
+  === Numerical optimization === 

+  This classification is somewhat arbitrary. Something more systematic like GAMS might be helpful. 

+  
+  ==== bindings ==== 

+  ;[http://repetae.net/john/recent/out/HsASA.html Adaptive Simulated Annealing] 

+  :A Haskell interface to Lester Ingber's adaptive simulating annealing code. 

+  
+  ;[http://hackage.haskell.org/package/cmaes CMAES] 

+  :A wrapper for Covariance Matrix Adaptation Evolution Strategy 

+  
+  ;[https://github.com/ghorn/nlopthaskell nlopthaskell] 

+  :A lowlevel binding to the nlopt library 

+  
+  ;[http://hackage.haskell.org/package/ipopths ipopths] 

+  :A haskell binding to ipopt including automatic differentiation 

+  
+  ;[http://hackage.haskell.org/package/glpkhs glpkhs] 

+  :A highlevel interface to GLPK's linear programming and mixed integer programming features. 

+  
+  ==== pure haskell ==== 

+  ;[http://hackage.haskell.org/package/nonlinearoptimization nonlinearoptimization] 

+  :A purehaskell CG_DESCENT method is implemented 

+  
+  === Miscellaneous libraries === 

;[http://www.robtougher.com/HaskellMath/ HaskellMath] 
;[http://www.robtougher.com/HaskellMath/ HaskellMath] 

:The HaskellMath library is a sandbox for experimenting with mathematics algorithms. So far I've implemented a few quantitative finance models (Black Scholes, Binomial Trees, etc) and basic linear algebra functions. Next I might work on either computer algebra or linear programming. All comments welcome! 
:The HaskellMath library is a sandbox for experimenting with mathematics algorithms. So far I've implemented a few quantitative finance models (Black Scholes, Binomial Trees, etc) and basic linear algebra functions. Next I might work on either computer algebra or linear programming. All comments welcome! 

−  ;[http://www.polyomino.f2s.com/david/haskell/codeindex.html Haskell for Maths] 

+  ;[http://hackage.haskell.org/package/HaskellForMaths HaskellForMaths] 

−  :David Amos' [http://www.polyomino.f2s.com/david/haskell/main.html collection of math libraries] in Haskell  including number theory, commutative algebra, combinatorics, permutation groups and more. 

+  :David Amos' library for combinatorics, group theory, commutative algebra and noncommutative algebra, which is described in an [http://haskellformaths.blogspot.com/ accompanying blog]. 

;[http://darcs.haskell.org/htam/ Various math stuff by Henning Thielemann] 
;[http://darcs.haskell.org/htam/ Various math stuff by Henning Thielemann] 

−  :This is some unsorted mathematical stuff including: 
+  :This is some unsorted mathematical stuff including: gnuplot wrapper (now maintained as separate package), portable grey map (PGM) image reader and writer, simplest numerical integration, differentiation, zero finding, interpolation, solution of differential equations, combinatorics, some solutions of math riddles, computation of fractal dimensions of iterated function systems (IFS) 
−  ;[http://repetae.net/john/recent/out/HsASA.html Adaptive Simulated Annealing] 

+  ;[[Numeric Quest]] 

−  :A Haskell interface to Lester Ingber's adaptive simulating annealing code. 

+  :Jan Skibinski wrote a collection of Haskell modules that are useful for Mathematics in general, and Quantum Mechanics in particular. 

−  ;[http://www.solcon.nl/mklooster/repos/hmm/ Hmm: Haskell Metamath] 

+  :Some of the modules are hosted on [http://darcs.haskell.org/numericquest/ haskell.org]. They include modules for: 

+  :* Rational numbers with transcendental functions 

+  :* Roots of polynomials 

+  :* Eigensystems 

+  :* Tensors 

+  :* Dirac quantum mechanics 

+  
+  :Other modules in Numeric Quest are currently only available via the [http://web.archive.org/web/20010605003250/http://www.numericquest.com/haskell/ Internet Archive]. They include, among many other things: 

+  :* [http://web.archive.org/web/*/http://www.numericquest.com/haskell/ State vector evolution] 

+  :* [http://web.archive.org/web/*/http://www.numericquest.com/haskell/ Short study of fuzzy oscillator] 

+  
+  :See the [[Numeric Quest]] page for more information. 

+  
+  ;[http://www.dinkla.net/fp/cglib.html Geometric Algorithms] 

+  :A small Haskell library, containing algorithms for twodimensional convex hulls, triangulations of polygons, Voronoidiagrams and Delaunaytriangulations, the QEDS data structure, kdtrees and rangetrees. 

+  
+  ;[http://home.solcon.nl/mklooster/repos/hmm/ Hmm: Haskell Metamath] 

:Hmm is a small Haskell library to parse and verify Metamath databases. 
:Hmm is a small Haskell library to parse and verify Metamath databases. 

−  ;[ 
+  ;[[Probabilistic Functional Programming]] 
:The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood. A nice aspect of this system is that simulations can be specified independently from their method of execution. That is, we can either fully simulate or randomize any simulation without altering the code which defines it. 
:The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood. A nice aspect of this system is that simulations can be specified independently from their method of execution. That is, we can either fully simulate or randomize any simulation without altering the code which defines it. 

;[[Sinc function]] 
;[[Sinc function]] 

+  
+  ;[[Gamma and Beta function]] 

;[http://repetae.net/john/recent/out/Boolean.html Boolean] 
;[http://repetae.net/john/recent/out/Boolean.html Boolean] 

Line 154:  Line 294:  
:HODE is a binding to the Open Dynamics Engine. ODE is an open source, high performance library for simulating rigid body dynamics. 
:HODE is a binding to the Open Dynamics Engine. ODE is an open source, high performance library for simulating rigid body dynamics. 

−  ;[http://cvs.haskell.org/darcs/numericquest/ Mirror of the following numeric modules by Jan Skibinski] 

+  ;[http://sourceforge.net/projects/rangedsets Ranged Sets] 

−  : 

+  :A ranged set is a list of nonoverlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set <math>(2.0, 3.0] \cup (5.3, 6)</math>. 

−  *[http://web.archive.org/web/*/http://www.numericquest.com/haskell/fractions.html Numerics with fractions]<em>(via Internet Archive since 10/06/2003).</em> 

+  
−  *[http://web.archive.org/web/*/http://www.numericquest.com/haskell/Roots.html Roots of polynomials]<em>(via Internet Archive since 10/06/2003).</em> It implements the well known Laguerre's method for finding complex roots of polynomials. 

+  ;[http://code.google.com/p/hhydra/ hhydra] 

−  *[http://web.archive.org/web/*/http://www.numericquest.com/haskell/Orthogonals.html Indexless linear algebra algorithms]<em>(via Internet Archive since 10/06/2003).</em> Orthogonalization, solution of linear equations, eigenvalues and eigenvectors. 

+  :Hhydra is a tool to compute Goodstein successions and hydra puzzles described by Bernard Hodgson in his article 'Herculean or Sisyphean tasks?' published in No 51 March 2004 of the Newsletter of the European Mathematical Society. 

−  * [http://web.archive.org/web/*/http://www.numericquest.com/haskell/ State vector evolution]<em>(via Internet Archive since 10/06/2003)</em> 

+  
−  * [http://web.archive.org/web/*/http://www.numericquest.com/haskell/ Short study of fuzzy oscillator]<em>(via Internet Archive since 10/06/2003)</em> 

+  [[Category:Mathematics*]] 

−  * [http://web.archive.org/web/*/http://www.numericquest.com/haskell/Tensor.html Ndimensional tensors]<em>(via Internet Archive since 10/06/2003)</em> 

+  {{LibrariesPage}} 
Latest revision as of 13:15, 11 December 2019
Contents
Applications
Physics
 Meep
 Meep (or MEEP) is a free finitedifference timedomain (FDTD) simulation software package developed at MIT to model electromagnetic systems. Meep used Haskell to generate C++ code, after Meep 1.0 Haskell generation droped in favor of handwritten C++ code.
 Numeric Quest
 Jan Skibinski's Numeric Quest library provides modules that are useful for Quantum Mechanics, among other things.
Libraries
Linear algebra
 bedandbreakfast
 A library that implements Matrix operations in pure Haskell using mutable arrays and the ST Monad. bedandbreakfast does not need any additional software to be installed and can perform basic matrix operations like multiplication, finding the inverse, and calculating determinants efficiently.
 hslinearalgebra
 Patrick Perry's linear algebra library, built on BLAS. hscblas seems to be a more uptodate fork.
 Digital Signal Processing
 Modules for matrix manipulation, Fourier transform, interpolation, spectral estimation, and frequency estimation.
 Indexaware linear algebra (original announcment)
 Frederik Eaton's library for statically checked matrix manipulation in Haskell
 Numeric Quest
 Jan Skibinski's Numeric Quest library provides several modules that are useful for linear algebra in general, among other things.
 vectorspace
 The vectorspace package defines classes and generic operations for vector spaces and affine spaces. It also defines a type of infinite towers of generalized derivatives (linear transformations).
 HMatrix
 By Alberto Ruiz. From the project website:
 A purely functional interface to linear algebra and other numerical algorithms, internally implemented using LAPACK, BLAS, and GSL.
 This package includes standard matrix decompositions (eigensystems, singular values, Cholesky, QR, etc.), linear systems, numeric integration, root finding, etc.
 Vec
 By Scott E. Dillard. Static dimension checking:
 Vectors are represented by lists with typeencoded lengths. The constructor is :., which acts like a cons both at the value and type levels, with () taking the place of nil. So x:.y:.z:.() is a 3d vector. The library provides a set of common listlike functions (map, fold, etc) for working with vectors. Built up from these functions are a small but useful set of linear algebra operations: matrix multiplication, determinants, solving linear systems, inverting matrices.
 HLinear
 By Alexandru Ghitza, Martin WesterholtRaum. PDE decomposition of matrices over division rings. See HLinear: Exact Dense Linear Algebra in Haskell.
 HLinear is a Haskell implementation of the PLE decomposition of matrices over division rings. It writes an arbitrary matrix as a product of a permutation matrix, a lower unitriangular matrix, and an echelon matrix.
See also
See also: Design discussions
Physical units
 Dimensionalized numbers
 Working with physical units like second, meter and so on in a typesafe manner.
 NumericPrelude: Physical units
 Numeric values with dynamically checked units.
 CalDims
 This is not simply a library providing a new type of
Num
class, but standalone calculation tool that supports user defined functions and units (basic and derived), so it can provide dimensionsafe calculation (not embedded but via shell). Calculations can be modified/saved via shell. It uses rational numbers to avoid rounding errors where possible.
 Dimensional
 Library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division of units.
Number representations
Decimal numbers
 Decimal arithmetic library
 An implementation of real decimal arithmetic, for cases where the binary floating point is not acceptable (for example, money).
Real and rational numbers
There are several levels of handling real numbers and according libraries.
Arbitrary precision
 Numbers have fixed precision
 Rounding errors accumulate
 Sharing is easy, i.e. in
sqrt pi + sin pi
,pi
is computed only once  Fast, because the routines can make use of the fast implementation of
Integer
operations
 Numeric Quest
 Jan Skibinski's Numeric Quest library provides, among other things, a type for arbitrary precision rational numbers with transcendental functions.
 FixedPoint.hs
 part of NumericPrelude project
 AERNBasics AERNReal AERNRealInterval AERNRealDouble
 contains type classes that form a foundation for rounded arithmetic and interval arithmetic with explicit control of rounding and the possibility to increase the rounding precision arbitrarily for types that support it. At the moment there are instances for Double floating point numbers where one can control the direction of rounding but cannot increase the rounding precision. In the near future instances for MPFR arbitrary precision numbers will be provided. Intervals can use as endpoints any type that supports directed rounding in the numerical order (such as Double or MPFR) and operations on intervals are rounded either outwards or inwards. Outwards rounding allows to safely approximate exact real arithmetic while a combination of both outwards and inwards rounding allows one to safely approximate exact interval arithmetic. Inverted intervals with Kaucher arithmetic are also supported.
 AERNRnToRm
 contains arithmetic of piecewise polynomial function intervals that approximate multidimensional (almost everywhere) continuous real functions to arbitrary precision
 numbers
 provides an uptodate, easytouse BigFloat implementation that builds with a modern GHC, among other things.
Dynamic precision
 You tell the precision and an expression shall be computed to, and the computer finds out, how precisely to compute the input values
 Rounding errors do not accumulate
 Sharing of temporary results is difficult, that is, in
sqrt pi + sin pi
,pi
will be computed twice, each time with the required precision.  Almost as fast as arbitrary precision computation
 ERA is an implementation (in Haskell 1.2) by David Lester.
 It is quite fast, possibly the fastest Haskell implementation. At 220 lines it is also the shortest. Probably the shortest implementation of exact real arithmetic in any language.
 The provided number type
CReal
is instance of the Haskell 98 numeric type classes and thus can be used whereever you used Float or Double before and encountered some numerical difficulties.  Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/
 ICReals is an implementation by Abbas Edalat, Marko Krznarć and Peter J. Potts.
 This implementation uses linear fractional transformations.
 Few Digits by Russell O'Connor.
 This is a prototype of the implementation he intendeds to write in Coq. Once the Coq implementation is complete, the Haskell code could be extracted producing an implementation that would be proved correct.
 COMP is an implementation by Yann Kieffer.
 The work is in beta and relies on new primitive operations on Integers which will be implemented in GHC. The library isn't available yet.
 Hera is an implementation by Aleš Bizjak.
 It uses the MPFR library to implement dyadic rationals, on top of which are implemented intervals and real numbers. A real number is represented as a function
Int > Interval
which represents a sequence of intervals converging to the real.
Dynamic precision by lazy evaluation
The real numbers are represented by an infinite datastructure, which allows you to increase precision successively by evaluating the data structure successively. All of the implementations below use some kind of digit stream as number representation. Sharing of results is simple. The implementations are either fast on simple expressions, because they use large blocks/bases, or they are fast on complex expressions, because they consume as little as possible input digits in order to emit the required output digits.
 BigFloat is an implementation by Martin Guy.
 It works with streams of decimal digits (strictly in the range from 0 to 9) and a separate sign. The produced digits are always correct. Output is postponed until the code is certain what the next digit is. This sometimes means that no more data is output.
 In "The Most Unreliable Technique in the World to compute pi" Jerzy Karczmarczuk develops some functions for computing pi lazily.
 NumericPrelude: positional numbers
 Represents a real number as pair
(exponent,[digit])
, where the digits areInt
s in the open range(basis,basis)
. There is no need for an extra sign item in the number data structure. Thebasis
can range from10
to1000
. (Binary representations can be derived from the hexadecimal representation.) Showing the numbers in traditional format (nonnegative digits) fails for fractions ending with a run of zeros. However the internal representation with negative digits can always be shown and is probably more useful for further processing. An interface for the numeric type hierarchy of the NumericPrelude project is provided.  It features
 basis conversion
 basic arithmetic: addition, subtraction, multiplication, division
 algebraic arithmetic: square root, other roots (no general polynomial roots)
 transcendental arithmetic: pi, exponential, logarithm, trigonometric and inverse trigonometric functions
Type class hierarchies
There are several approaches to improve the numeric type class hierarchy.
 Dylan Thurston and Henning Thielemann's Numeric Prelude
 Experimental revised framework for numeric type classes. Needs hiding of Prelude, overriding hidden functions like fromInteger and multiparameter type classes. Probably restricted to GHC.
 Jerzy Karczmarczuk's approach
 Serge D. Mechveliani's Basic Algebra proposal
 Andrew Frank's approach
 The proposal: ftp://ftp.geoinfo.tuwien.ac.at/frank/numbersPrelude_v1.pdf
 Haskell Prime
 Ongoing efforts for the language revision
Discrete mathematics
 Number Theory Library
 Andrew Bromage's Haskell number theory library, providing operations on primes, fibonacci sequences and combinatorics.
 HGAL
 An haskell implementation of Brendan McKay's algorithm for graph canonic labeling and automorphism group. (aka Nauty)
 Computational Oriented Matroids
 is a book by Jürgen G. Bokowski, where he develops Haskell code for Matroid computations.
See also Libraries and tools/Cryptography
Computer Algebra
 DoCon, the Algebraic Domain Constructor
 A library by Sergey D. Mechveliani for Algebra, turns GHCi into a kind of Computer Algebra System
 Papers by Jerzy Karczmarczuk
 Some interesting uses of Haskell in mathematics, including functional differentiation, power series, continued fractions.
 HCAS by Rob Tougher.
Statistics
 hstats
 Statistical Computing with Haskell
 hmatrixgslstats
 A binding to the statistics portion of GSL. Works with hmatrix
 hstatistics
 A library for doing statistics. Works with hmatrix
Plotting
 easyplot
 Simple and easy wrapper to gnuplot.
 Gnuplot
 Simple wrapper to gnuplot
 hmatrix
 contains a deprecated gnuplot wrapper
 Chart
 A library for generating 2D Charts and Plots, based upon the cairo graphics library.
 plot
 A library for generating figures, based upon the cairo graphics libary with
a simple, monadic interface.
 probability
 the module Numeric.Probability.Visualize contains a wrapper to R
 matplotlibhaskell
 Haskell bindings for Python's Matplotlib
 bokehhs
 Haskell bindings for Bokeh
Numerical optimization
This classification is somewhat arbitrary. Something more systematic like GAMS might be helpful.
bindings
 Adaptive Simulated Annealing
 A Haskell interface to Lester Ingber's adaptive simulating annealing code.
 CMAES
 A wrapper for Covariance Matrix Adaptation Evolution Strategy
 nlopthaskell
 A lowlevel binding to the nlopt library
 ipopths
 A haskell binding to ipopt including automatic differentiation
 glpkhs
 A highlevel interface to GLPK's linear programming and mixed integer programming features.
pure haskell
 nonlinearoptimization
 A purehaskell CG_DESCENT method is implemented
Miscellaneous libraries
 HaskellMath
 The HaskellMath library is a sandbox for experimenting with mathematics algorithms. So far I've implemented a few quantitative finance models (Black Scholes, Binomial Trees, etc) and basic linear algebra functions. Next I might work on either computer algebra or linear programming. All comments welcome!
 HaskellForMaths
 David Amos' library for combinatorics, group theory, commutative algebra and noncommutative algebra, which is described in an accompanying blog.
 Various math stuff by Henning Thielemann
 This is some unsorted mathematical stuff including: gnuplot wrapper (now maintained as separate package), portable grey map (PGM) image reader and writer, simplest numerical integration, differentiation, zero finding, interpolation, solution of differential equations, combinatorics, some solutions of math riddles, computation of fractal dimensions of iterated function systems (IFS)
 Numeric Quest
 Jan Skibinski wrote a collection of Haskell modules that are useful for Mathematics in general, and Quantum Mechanics in particular.
 Some of the modules are hosted on haskell.org. They include modules for:
 Rational numbers with transcendental functions
 Roots of polynomials
 Eigensystems
 Tensors
 Dirac quantum mechanics
 Other modules in Numeric Quest are currently only available via the Internet Archive. They include, among many other things:
 See the Numeric Quest page for more information.
 Geometric Algorithms
 A small Haskell library, containing algorithms for twodimensional convex hulls, triangulations of polygons, Voronoidiagrams and Delaunaytriangulations, the QEDS data structure, kdtrees and rangetrees.
 Hmm: Haskell Metamath
 Hmm is a small Haskell library to parse and verify Metamath databases.
 Probabilistic Functional Programming
 The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood. A nice aspect of this system is that simulations can be specified independently from their method of execution. That is, we can either fully simulate or randomize any simulation without altering the code which defines it.
 Boolean
 A general boolean algebra class and some instances for Haskell.
 HODE
 HODE is a binding to the Open Dynamics Engine. ODE is an open source, high performance library for simulating rigid body dynamics.
 Ranged Sets
 A ranged set is a list of nonoverlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set .
 hhydra
 Hhydra is a tool to compute Goodstein successions and hydra puzzles described by Bernard Hodgson in his article 'Herculean or Sisyphean tasks?' published in No 51 March 2004 of the Newsletter of the European Mathematical Society.
This page contains a list of libraries and tools in a certain category. For a comprehensive list of such pages, see Applications and libraries.