Caputo - iparsw/differintP GitHub Wiki
Caputo-Type Pointwise Fractional Derivatives
Overview
These functions compute the Caputo fractional derivative of a function at a single point (usually the endpoint of the discretized domain), using several established numerical methods. The Caputo derivative is widely used in modeling and simulation, especially for initial value problems with physical initial conditions.
Implemented methods:
- CaputoL1point — L1 discretization for $0 < \alpha < 1$
- CaputoL2point — L2 discretization for $1 < \alpha < 2$
- CaputoL2Cpoint — L2C discretization for $0 < \alpha < 2$
- CaputoFromRLpoint — Caputo derivative via conversion from Riemann-Liouville (experimental, not working)
CaputoL1point
Computes the Caputo derivative at a point using the L1 method (suitable for $0 < \alpha < 1$).
- Based on finite differences of function values and fractional-weighted coefficients.
- See: Karniadakis, G.E. (2019), Handbook of Fractional Calculus with Applications, Volume 3: Numerical Methods. De Gruyter.
CaputoL1point(
alpha: float,
f_name: Callable | np.ndarray | list,
domain_start: float = 0.0,
domain_end: float = 1.0,
num_points: int = 100,
) -> float
Parameters:
alpha
: Fractional order ($0 < \alpha < 1$)f_name
: Callable or array of function valuesdomain_start
,domain_end
: Domain endpointsnum_points
: Number of grid points
Returns:
- Caputo L1 derivative at the endpoint (
float
)
Example:
from differintP import CaputoL1point
val = CaputoL1point(0.5, np.sin, 0, np.pi, 100)
CaputoL2point
Computes the Caputo derivative at a point using the L2 method ($1 < \alpha < 2$).
- Requires evaluating the function at a point outside the domain ($f(domain_end + h)$).
- Only works for callable input.
- See: Karniadakis, G.E. (2019).
CaputoL2point(
alpha: float,
f_name: Callable,
domain_start: float = 0.0,
domain_end: float = 1.0,
num_points: int = 100,
) -> float
Parameters:
alpha
: Fractional order ($1 < \alpha < 2$)f_name
: Callable function onlydomain_start
,domain_end
,num_points
: as above
Returns:
- Caputo L2 derivative at the endpoint (
float
)
Example:
from differintP import CaputoL2point
val = CaputoL2point(1.5, np.sin, 0, np.pi, 100)
CaputoL2Cpoint
Computes the Caputo derivative at a point using the L2C method ($0 < \alpha < 2$).
- Requires evaluating at points outside the domain ($f(domain_end + h)$ and $f(-h)$).
- Only works for callable input.
- See: Karniadakis, G.E. (2019).
CaputoL2Cpoint(
alpha: float,
f_name: Callable,
domain_start: float = 0.0,
domain_end: float = 1.0,
num_points: int = 100,
) -> float
Parameters:
alpha
: Fractional order ($0 < \alpha < 2$)f_name
: Callable function onlydomain_start
,domain_end
,num_points
: as above
Returns:
- Caputo L2C derivative at the endpoint (
float
)
Example:
from differintP import CaputoL2Cpoint
val = CaputoL2Cpoint(0.8, np.sin, 0, np.pi, 100)
CaputoFromRLpoint
(Experimental, currently not working)
Attempts to compute the Caputo derivative using a conversion formula from RL differintegrals.
- See: Du, R., Yan, Y., & Liang, Z. (2019). A high-order scheme to approximate the Caputo fractional derivative and its application to solve the fractional diffusion wave equation, J. Computational Physics, 376, pp. 1312-1330.
References
- Karniadakis, G.E. (2019). Handbook of Fractional Calculus with Applications, Volume 3: Numerical Methods. De Gruyter.
- Du, R., Yan, Y., & Liang, Z. (2019). A high-order scheme to approximate the Caputo fractional derivative and its application to solve the fractional diffusion wave equation, J. Computational Physics, 376, pp. 1312-1330.