Difference between revisions of "Applications and libraries/Mathematics"

From HaskellWiki
Jump to navigation Jump to search
(Few Digits is also "dynamic precision")
(categorised COMP)
Line 58: Line 58:
 
*Data.Real.CReal> answer 1000 (exp 1 + sqrt 2)
 
*Data.Real.CReal> answer 1000 (exp 1 + sqrt 2)
 
-->
 
-->
  +
 
;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.
   
 
==== Lazily evaluated ====
 
==== Lazily evaluated ====
Line 85: Line 88:
 
:* 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
 
==== uncategorised ====
 
 
;COMP is an implementation by Yann Kieffer.
 
:The work is in beta, and the library isn't available yet.
 
   
   

Revision as of 08:09, 24 October 2006

The copyright status of this work is not known. Please help resolve this on the talk page.

This page contains a list of libraries and tools in a certain category. For a comprehensive list of such pages, see Applications and libraries.

Libraries for numerical algorithms and mathematics

Linear algebra

GSLHaskell
High level functional interface to standard linear algebra computations and other numerical algorithms based on the GNU Scientific Library. Alternative download site.
Wrapper to CLAPACK
Digital Signal Processing
Modules for matrix manipulation, digital signal processing, spectral estimation, and frequency estimation.
Index-aware linear algebra
Frederik Eaton's library for statically checked matrix manipulation in Haskell
Indexless linear algebra
algorithms by Jan Skibinski, see below

See also: Design discussions

Number representations

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


There are several levels of handling real numbers and according libraries.

Arbitrary precision

All numbers have fixed precision, rounding errors accumulate.

Fractions.hs
algorithms by Jan Skibinski, see below
FixedPoint.hs
part of NumericPrelude project

Dynamic precision

You tell the precision, an expression shall be computed to and the computer finds out, how precise to compute the input values.

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.
Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/
IC-Reals 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.

Lazily evaluated

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.

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 are Ints in the open range (-basis,basis).
There is no need for an extra sign item in the number data structure.
The basis can range from 10 to 1000.
(Binary representations can be derived from the hexadecimal representation.)
Showing the numbers in traditional format (non-negative 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 multi-parameter 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

other

Geometric Algorithms
A small Haskell library, containing algorithms for two-dimensional convex hulls, triangulations of polygons, Voronoi-diagrams and Delaunay-triangulations, the QEDS data structure, kd-trees and range-trees.
Papers by Jerzy Karczmarczuk
Some interesting uses of Haskell in mathematics, including functional differentiation, power series, continued fractions.
DoCon - Algebraic Domain Constructor
A Computer Algebra System
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!
Haskell for Maths
David Amos' collection of math libraries in Haskell - including number theory, commutative algebra, combinatorics, permutation groups and more.
Various math stuff by Henning Thielemann
This is some unsorted mathematical stuff including: GNUPlot wrapper, 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)
Adaptive Simulated Annealing
A Haskell interface to Lester Ingber's adaptive simulating annealing code.
Number Theory Library
Andrew Bromage's Haskell number theory library, providing operations on primes, fibonacci sequences and combinatorics.
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.
Sinc function
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.
HGAL
An haskell implementation of Brendan McKay's algorithm for graph canonic labeling and automorphism group. (aka Nauty)
Mirror of the following numeric modules by Jan Skibinski