generative-art-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numerics.VectorAnalysis

Synopsis

Operators with default settings

grad :: (Vec2 -> Double) -> Vec2 -> Vec2 Source #

Gradient with predefined sampling distance.

\[ \text{grad}(f) = \begin{pmatrix} \partial_x f \\ \partial_y f \end{pmatrix} \]

The fire-and-forget version of gradH.

divergence :: (Vec2 -> Vec2) -> Vec2 -> Double Source #

Divergence with predefined sampling distance. Named to avoid clashing with integer division.

\[ \text{div}(f) = \partial_xf_x + \partial_y f_y \]

The fire-and-forget version of divH.

curl :: (Vec2 -> Vec2) -> Vec2 -> Double Source #

Curl with predefined sampling distance. Note that in two dimensions, the curl is simply a number. For a different 2D adaptation of the \(\text{curl}\) operator, see curlZ.

\[ \text{curl}(f) = \partial_x f_y - \partial_y f_x \]

The fire-and-forget version of curlH.

curlZ :: (Vec2 -> Double) -> Vec2 -> Vec2 Source #

Curl of a purely-z-component 3D vector field, which is another common way (than curl) to implement a two-dimensional version of \(\text{curl}\):

\[ \text{curl}_z(\psi) = \left[\text{curl}_{3D} \begin{pmatrix}0\\0\\\psi\end{pmatrix}\right]_{\text{2D part}} = \begin{pmatrix}\partial_y\psi\\-\partial_x\psi\end{pmatrix} \]

Because of this, the result is always divergence-free, because \(\forall f. \text{div}(\text{curl}(f))=0\).

Using curlZ to create divergence-free flow fields is similar to using grad to create curl-free force fields. The argument for curlZ is known as the vector or stream potential in fluid dynamics, with the resulting vector field being known as a stream function.

The fire-and-forget version of curlZH.

laplace :: (Vec2 -> Double) -> Vec2 -> Double Source #

Laplacian with predefined sampling distance.

\[ \nabla^2f = \partial^2_x f + \partial^2_y f \]

The fire-and-forget version of laplaceH.

Operators with configurable step width

gradH Source #

Arguments

:: Double

\(h\) as in \(\frac{f(x+h)-f(x)}h\)

-> (Vec2 -> Double) 
-> Vec2 -> Vec2 

Gradient with customizable sampling distance. The configurable version of grad.

divH Source #

Arguments

:: Double

\(h\) as in \(\frac{f(x+h)-f(x)}h\)

-> (Vec2 -> Vec2) 
-> Vec2 -> Double 

Divergence with customizable sampling distance. The configurable version of divergence.

curlH Source #

Arguments

:: Double

\(h\) as in \(\frac{f(x+h)-f(x)}h\)

-> (Vec2 -> Vec2) 
-> Vec2 -> Double 

Curl with customizable sampling distance. The configurable version of curl.

curlZH Source #

Arguments

:: Double

\(h\) as in \(\frac{f(x+h)-f(x)}h\)

-> (Vec2 -> Double) 
-> Vec2 
-> Vec2 

Curl of the z component of a 3D vector field, with customizable sampling distance. The configurable version of curlZ.

laplaceH Source #

Arguments

:: Double

\(h\) as in \(\frac{f(x+h)-f(x)}h\)

-> (Vec2 -> Double) 
-> Vec2 -> Double 

Laplacian with customizable sampling distance. The configurable version of laplace.