# Numeric Quest

### From HaskellWiki

(Difference between revisions)

(Oops, revert previous change) |
(darcs.haskell.org -> code.haskell.org) |
||

(9 intermediate revisions by 2 users not shown) | |||

Line 5: | Line 5: | ||

and Quantum Mechanics in particular. |
and Quantum Mechanics in particular. |
||

− | Some of the modules in Numeric Quest are hosted on |
+ | Some of the modules in Numeric Quest are hosted in a |

− | [http://darcs.haskell.org/numeric-quest/ haskell.org]. |
+ | [http://www.darcs.net/ Darcs] repository on |

+ | [http://code.haskell.org/~thielema/numeric-quest/ haskell.org] |
||

+ | and published on [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numeric-quest Hackage]. |
||

Those are summarized below. |
Those are summarized below. |
||

Line 13: | Line 13: | ||

See Jan Skibinski's |
See Jan Skibinski's |
||

[http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ Haskell page via the Internet Archive] for more information. |
[http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ Haskell page via the Internet Archive] for more information. |
||

+ | |||

+ | :'''''Note:''''' The Darcs repository on haskell.org was ''not'' set up by the original author of Numeric Quest. Rather, it was created by Henning Thielemann to facilitate further development of Numeric Quest. |
||

+ | |||

+ | :The modules in the Darcs repository are based on the original author's version that can be obtained from the author's [http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ Haskell page via the Internet Archive]. Alternatively, you can reconstruct the original author's version of each module using the earliest patch in the Darcs repository for the module. |
||

== Numeric Quest modules hosted on haskell.org == |
== Numeric Quest modules hosted on haskell.org == |
||

+ | |||

+ | The following summaries are abstracted from the author's comments |
||

+ | in the modules themselves. |
||

+ | |||

+ | === Rational numbers with transcendental functions === |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/Fraction.hs Fraction.hs] |
||

+ | |||

+ | :This is a generalized Rational in disguise. Rational, as a type synonym, could not be directly made an instance of any new class at all. But we would like it to be an instance of Transcendental, where trigonometry, hyperbolics, logarithms, etc. are defined. So here we are tiptoe-ing around, re-defining everything from scratch, before designing the transcendental functions -- which is the main motivation for this module. |
||

+ | |||

+ | :Aside from its ability to compute transcendentals, Fraction allows for denominators zero. Unlike Rational, Fraction does not produce run-time errors for zero denominators, but use such entities as indicators of invalid results -- plus or minus infinities. Operations on fractions never fail in principle. |
||

+ | |||

+ | :Some of the functions are implemented using continued fractions, and others using Taylor series. |
||

+ | |||

+ | === Roots of polynomials === |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/Roots.hs Roots.hs] |
||

+ | |||

+ | :List of complex roots of a polynomial a0 + a1*x + a2*x^2... |
||

+ | |||

+ | === Eigensystems === |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/Eigensystem.hs Eigensystem.hs] |
||

+ | |||

+ | :This module extends the QuantumVector module by providing functions to calculate eigenvalues and eigenvectors of Hermitian operators. Such toolkit is of primary importance due to pervasiveness of eigenproblems in Quantum Mechanics. |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/EigensystemNum.hs EigensystemNum.hs] |
||

+ | |||

+ | === Tensors === |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/Tensor.lhs Tensor.lhs] |
||

+ | |||

+ | :This is a quick sketch of what might be a basis of a real Tensor module. |
||

+ | |||

+ | :Datatype Tensor defined here is an instance of class Eq, Show and Num. In addition, several customized operations are defined for variety of inner products. |
||

+ | |||

+ | :Tensor components are Doubles. |
||

+ | |||

+ | :The shape of tensors defined here involves two parameters: dimension and rank. Rank is associated with the depth of the tensor tree and corresponds to a total number of indices by which you can access the individual components. |
||

+ | |||

+ | === Dirac quantum mechanics === |
||

+ | |||

+ | ;[http://code.haskell.org/~thielema/numeric-quest/QuantumVector.lhs QuantumVector.lhs] |
||

+ | |||

+ | :This is our attempt to model the abstract Dirac's formalism of Quantum Mechanics in Haskell. |
||

+ | |||

+ | :We recognize a quantum state as an abstract vector | x >, which can be represented in one of many possible bases -- similar to many alternative representations of a 3D vector in rotated systems of coordinates. A choice of a particular basis is controlled by a generic type variable, which can be any Haskell object -- providing that it supports a notion of equality and ordering. A state which is composed of many quantum subsystems, not necessarily of the same type, can be represented in a vector space considered to be a tensor product of the subspaces. |
||

+ | |||

+ | :With this abstract notion we proceed with Haskell definition of two vector spaces: Ket and its dual Bra. We demonstrate that both are properly defined according to the abstract mathematical definition of vector spaces. We then introduce inner product and show that our Bra and Ket can be indeed considered the vector spaces with inner product. |
||

[[Category:Mathematics]] |
[[Category:Mathematics]] |

## Latest revision as of 13:59, 26 January 2010

## Contents |

## [edit] 1 Introduction

Numeric Quest is a collection of Haskell modules written by Jan Skibinski. The modules in Numeric Quest are useful for Mathematics in general, and Quantum Mechanics in particular.

Some of the modules in Numeric Quest are hosted in a Darcs repository on haskell.org and published on Hackage. Those are summarized below.

Other modules in Numeric Quest are currently only available via the Internet Archive. See Jan Skibinski's Haskell page via the Internet Archive for more information.

The Darcs repository on haskell.org was**Note:***not*set up by the original author of Numeric Quest. Rather, it was created by Henning Thielemann to facilitate further development of Numeric Quest.

- The modules in the Darcs repository are based on the original author's version that can be obtained from the author's Haskell page via the Internet Archive. Alternatively, you can reconstruct the original author's version of each module using the earliest patch in the Darcs repository for the module.

## [edit] 2 Numeric Quest modules hosted on haskell.org

The following summaries are abstracted from the author's comments in the modules themselves.

### [edit] 2.1 Rational numbers with transcendental functions

- This is a generalized Rational in disguise. Rational, as a type synonym, could not be directly made an instance of any new class at all. But we would like it to be an instance of Transcendental, where trigonometry, hyperbolics, logarithms, etc. are defined. So here we are tiptoe-ing around, re-defining everything from scratch, before designing the transcendental functions -- which is the main motivation for this module.

- Aside from its ability to compute transcendentals, Fraction allows for denominators zero. Unlike Rational, Fraction does not produce run-time errors for zero denominators, but use such entities as indicators of invalid results -- plus or minus infinities. Operations on fractions never fail in principle.

- Some of the functions are implemented using continued fractions, and others using Taylor series.

### [edit] 2.2 Roots of polynomials

- List of complex roots of a polynomial a0 + a1*x + a2*x^2...

### [edit] 2.3 Eigensystems

- This module extends the QuantumVector module by providing functions to calculate eigenvalues and eigenvectors of Hermitian operators. Such toolkit is of primary importance due to pervasiveness of eigenproblems in Quantum Mechanics.

### [edit] 2.4 Tensors

- This is a quick sketch of what might be a basis of a real Tensor module.

- Datatype Tensor defined here is an instance of class Eq, Show and Num. In addition, several customized operations are defined for variety of inner products.

- Tensor components are Doubles.

- The shape of tensors defined here involves two parameters: dimension and rank. Rank is associated with the depth of the tensor tree and corresponds to a total number of indices by which you can access the individual components.

### [edit] 2.5 Dirac quantum mechanics

- This is our attempt to model the abstract Dirac's formalism of Quantum Mechanics in Haskell.

- We recognize a quantum state as an abstract vector | x >, which can be represented in one of many possible bases -- similar to many alternative representations of a 3D vector in rotated systems of coordinates. A choice of a particular basis is controlled by a generic type variable, which can be any Haskell object -- providing that it supports a notion of equality and ordering. A state which is composed of many quantum subsystems, not necessarily of the same type, can be represented in a vector space considered to be a tensor product of the subspaces.

- With this abstract notion we proceed with Haskell definition of two vector spaces: Ket and its dual Bra. We demonstrate that both are properly defined according to the abstract mathematical definition of vector spaces. We then introduce inner product and show that our Bra and Ket can be indeed considered the vector spaces with inner product.

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