How should a derivative approximation change near a hard parameter boundary?
MathematicsLevel: IntermediateDerivative and probability numerics
How should a derivative approximation change near a hard parameter boundary?
Hints
- Check both perturbed points.
- Respect the domain.
Answer
Use a feasible one-sided stencil or adjust the step. A central stencil can evaluate outside the domain and produce invalid values.
Source and licence: SciPy — numerical differentiation · BSD-3-Clause · answer: Quantoros editorial