Difference between revisions of "Numeric Quest"

From HaskellWiki
Jump to navigation Jump to search
(Added categories)
Line 15: Line 15:
   
 
== Numeric Quest modules hosted on haskell.org ==
 
== Numeric Quest modules hosted on haskell.org ==
  +
  +
=== Rational numbers ===
  +
  +
;[http://darcs.haskell.org/numeric-quest/Fraction.hs Fraction.hs]
  +
  +
:This is a generalized Rational in disguise. Rational, as a type
  +
synonim, 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.
  +
  +
=== Polynomials ===
  +
  +
;[http://darcs.haskell.org/numeric-quest/Roots.hs Roots.hs]
  +
  +
:List of complex roots of a polynomial
  +
a0 + a1*x + a2*x^2...
  +
  +
=== General linear algebra ===
  +
  +
;[http://darcs.haskell.org/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://darcs.haskell.org/numeric-quest/EigensystemNum.hs EigensystemNum.hs]
  +
  +
=== Tensors ===
  +
  +
;[http://darcs.haskell.org/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.
  +
  +
=== Quantum mechanics ===
  +
  +
;[http://darcs.haskell.org/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]]

Revision as of 11:52, 22 January 2007

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 on haskell.org. 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.

Numeric Quest modules hosted on haskell.org

Rational numbers

Fraction.hs
This is a generalized Rational in disguise. Rational, as a type

synonim, 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.

Polynomials

Roots.hs
List of complex roots of a polynomial

a0 + a1*x + a2*x^2...

General linear algebra

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.

EigensystemNum.hs

Tensors

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.

Quantum mechanics

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. This page contains a list of libraries and tools in a certain category. For a comprehensive list of such pages, see Applications and libraries.