FiniteDifferenceFunction

The FiniteDifferenceFunction encapsulates a bunch of functionality extracted from Fornberger’s Calculation of Wieghts in Finite Difference Formulas (https://epubs.siam.org/doi/pdf/10.1137/S0036144596322507)

Only applies to direct product grids, but each subgrid can be regular or irregular

Properties and Methods

regular_difference: method
from_grid: method

 

__init__(self, *diffs, axes=0, contract=False): 

Constructs an object to take finite differences derivatives of grids of data

  • diffs: FiniteDifference1D

    A set of differences to take along successive axes in the data

  • axes: int | Iterable[int]

    The axes to take the specified differences along

  • contract: bool

    Whether to reduce the shape of the returned tensor if applicable after application

 

apply(self, vals, axes=None, mesh_spacing=None, contract=None): 

Iteratively applies the stored finite difference objects to the vals

  • vals: np.ndarray

    The tensor of values to take the difference on

  • axes: int | Iterable[int]

    The axis or axes to take the differences along (defaults to self.axes)

  • :returns: np.ndarray

    The tensor of derivatives

 

__call__(self, vals, axes=None, mesh_spacing=None): 

 

@property
order(self): 
  • :returns: tuple[int]

    the order of the derivative requested

 

@property
weights(self): 
  • :returns: tuple[np.array[float]]

    the weights for the specified stencil

 

@property
widths(self): 
  • :returns: tuple[(int, int)]

    the number of points in each dimension, left and right, for the specified stencil

Examples

FiniteDifferenceFunction

The FiniteDifferenceFunction encapsulates a bunch of functionality extracted from Fornberger’s Calculation of Wieghts in Finite Difference Formulas (https://epubs.siam.org/doi/pdf/10.1137/S0036144596322507)

Only applies to direct product grids, but each subgrid can be regular or irregular

Properties and Methods

regular_difference: method
from_grid: method

 

__init__(self, *diffs, axes=0, contract=False): 

Constructs an object to take finite differences derivatives of grids of data

  • diffs: FiniteDifference1D

    A set of differences to take along successive axes in the data

  • axes: int | Iterable[int]

    The axes to take the specified differences along

  • contract: bool

    Whether to reduce the shape of the returned tensor if applicable after application

 

apply(self, vals, axes=None, mesh_spacing=None, contract=None): 

Iteratively applies the stored finite difference objects to the vals

  • vals: np.ndarray

    The tensor of values to take the difference on

  • axes: int | Iterable[int]

    The axis or axes to take the differences along (defaults to self.axes)

  • :returns: np.ndarray

    The tensor of derivatives

 

__call__(self, vals, axes=None, mesh_spacing=None): 

 

@property
order(self): 
  • :returns: tuple[int]

    the order of the derivative requested

 

@property
weights(self): 
  • :returns: tuple[np.array[float]]

    the weights for the specified stencil

 

@property
widths(self): 
  • :returns: tuple[(int, int)]

    the number of points in each dimension, left and right, for the specified stencil

Examples


Edit Examples or Create New Examples
Edit Template or Create New Template
Edit Docstrings


Edit Examples or Create New Examples
Edit Template or Create New Template
Edit Docstrings