Symbolic

class findiff.SymbolicDiff(mesh, axis=0, degree=1)

A symbolic representation of the finite difference approximation of a partial derivative. Based on sympy.

Constructor

Parameters

mesh: SymbolicMesh

The symbolic grid on which to evaluate the derivative.

axis: int

The index of the axis with respect to which to differentiate.

degree: int > 0

The degree of the partial derivative.

class findiff.SymbolicMesh(coord, equidistant=True)

Represents the mesh on which to evaluate finite difference approximations.

Constructor.

Parameters

coord: str

A comma-separated string of coordinate names for the mesh, e.g. “x,y” or simply “x”

equidistant: bool

Flag indicating whether the mesh is equidistant.

property coord

Returns a tuple with the symbols for the coordinates.

static create_symbol(name)

Creates a sympy symbol of a given name which can carry as many indices as the mesh has dimensions.

Parameters

name: str

The name of the meshed symbol.

Returns

An index-carrying sympy symbol (IndexedBase).

property ndims

The number of dimensions of the mesh.

property spacing

Returns a tuple with the spacing of the mesh along all axes. Only makes sense for equidistant grid. Raises exception in case of non-equidistant grids.