derivkit.derivatives.finite.stencil module#
Stencil definitions and utilities for finite-difference derivative calculations.
- derivkit.derivatives.finite.stencil.ORDERS = (1, 2, 3, 4)#
A list of supported derivative orders.
- derivkit.derivatives.finite.stencil.STENCILS = (3, 5, 7, 9)#
A list of supported stencil sizes.
- derivkit.derivatives.finite.stencil.TRUNCATION_ORDER = {(3, 1): 2, (3, 2): 2, (5, 1): 4, (5, 2): 4, (5, 3): 2, (5, 4): 2, (7, 1): 6, (7, 2): 6, (7, 3): 4, (7, 4): 4, (9, 1): 8, (9, 2): 6, (9, 3): 5, (9, 4): 3}#
Dictionary of truncation order for the supported stencil sizes and derivative orders.
- derivkit.derivatives.finite.stencil.get_finite_difference_tables(stepsize: float) tuple[dict[int, list[int]], dict[tuple[int, int], ndarray]]#
Dynamically computes offset patterns and coefficient tables.
- Parameters:
stepsize – The step size to use for the stencil spacing.
- Returns:
A dictionary of offsets, and a dictionary of coefficient tables, for a range of supported stencil sizes and derivative orders.
- derivkit.derivatives.finite.stencil.validate_supported_combo(num_points: int, order: int) None#
Validates that the (stencil size, order) combo is supported.
- Parameters:
num_points – Number of points in the finite difference stencil.
order – The order of the derivative to compute.
- Raises:
ValueError – If the combination of num_points and order is not supported.