Interpolation
When to Use
Use this skill when working on interpolation problems in numerical methods.
Decision Tree
Assess Data Characteristics
- How many data points? Spacing uniform or non-uniform?
- Is data smooth or noisy?
- Need derivatives at endpoints?
Select Interpolation Method
- Few points (<10): Polynomial (Lagrange, Newton)
- Many points, smooth data: Cubic splines
- Noisy data: Smoothing splines or least squares
- High dimensions: Use simplex-based (n+1 neighbors vs 2^n)
Implement with SciPy
scipy.interpolate.CubicSpline(x, y) - natural cubic spline
scipy.interpolate.make_interp_spline(x, y, k=3) - B-spline
scipy.interpolate.interp1d(x, y, kind='cubic') - 1D interpolation
Validate Results
- Check for Runge's phenomenon at boundaries (high-degree polynomials)
- Cross-validate: leave-one-out error estimation
- Visual inspection of interpolated curve
sympy_compute.py limit "interp_error" --at boundaries
High-Dimensional Considerations
- Coxeter-Freudenthal-Kuhn triangulation for O(n log n) point location
- Barycentric subdivision for balanced performance
Tool Commands
Scipy_Cubic_Spline
uv run python -c "from scipy.interpolate import CubicSpline; import numpy as np; x = np.array([0,1,2,3]); y = np.array([0,1,4,9]); cs = CubicSpline(x, y); print(cs(1.5))"
Scipy_Bspline
uv run python -c "from scipy.interpolate import make_interp_spline; import numpy as np; x = np.array([0,1,2,3]); y = np.array([0,1,4,9]); bspl = make_interp_spline(x, y, k=3); print(bspl(1.5))"
Sympy_Lagrange
uv run python -m runtime.harness scripts/sympy_compute.py interpolate "[(0,0),(1,1),(2,4)]" --var x
Key Techniques
From indexed textbooks:
- [An Introduction to Numerical Analysis... (Z-Library)] DISCUSSION OF THE LITERATURE Discussion of the Literature As noted in the introduction, interpolation theory is a foundation for the development of methods in numerical integration and differentiation, approxima tion theory, and the numerical solution of differential equations. Each of these· topics is developed in the following chapters, and the associated literature is discussed at that point. Additional results on interpolation theory are given in de Boor (1978), Davis (1963), Henrici (1982, chaps.
- [Numerical analysis (Burden R.L., Fair... (Z-Library)] The most commonly used form of interpolation is piecewise-polynomial interpolation. If function and derivative values are available, piecewise cubic Hermite interpolation is recommended. This is the preferred method for interpolating values of a function that is the solution to a differential equation.
- [Numerical analysis (Burden R.L., Fair... (Z-Library)] Copyright 2010 Cengage Learning. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
- [Numerical analysis (Burden R.L., Fair... (Z-Library)] Galerkin and Rayleigh-Ritz methods are both determined by Eq. However, this is not the case for an arbitrary boundary-value problem. A treatment of the similarities and differences in the two methods and a discussion of the wide application of the Galerkin method can be found in [Schul] and in [SF].
- [An Introduction to Numerical Analysis... (Z-Library)] Polynomial interpolation theory has a number of important uses. In this text, its primary use is to furnish some mathematical tools that are used in developing methods in the areas of approximation theory, numerical integration, and the numerical solution of differential equations. A second use is in developing means - for working with functions that are stored in tabular form.
Cognitive Tools Reference
See .claude/skills/math-mode/SKILL.md for full tool documentation.
Source: parcadei/Continuous-Claude-v3 → .claude/skills/math/numerical-methods/interpolation/SKILL.md
1---
2name: interpolation
3description: "Problem-solving strategies for interpolation in numerical methods"
4allowed-tools: "[Bash, Read]"
5category: general-purpose
6source_repo: parcadei/Continuous-Claude-v3
7source_path: ".claude/skills/math/numerical-methods/interpolation/SKILL.md"
8source_url: https://github.com/parcadei/Continuous-Claude-v3/blob/HEAD/.claude/skills/math/numerical-methods/interpolation/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/parcadei/interpolation
11---
12
13
14# Interpolation
15
16## When to Use
17
18Use this skill when working on interpolation problems in numerical methods.
19
20## Decision Tree
21
22
231. **Assess Data Characteristics**
24 - How many data points? Spacing uniform or non-uniform?
25 - Is data smooth or noisy?
26 - Need derivatives at endpoints?
27
282. **Select Interpolation Method**
29 - Few points (<10): Polynomial (Lagrange, Newton)
30 - Many points, smooth data: Cubic splines
31 - Noisy data: Smoothing splines or least squares
32 - High dimensions: Use simplex-based (n+1 neighbors vs 2^n)
33
343. **Implement with SciPy**
35 - `scipy.interpolate.CubicSpline(x, y)` - natural cubic spline
36 - `scipy.interpolate.make_interp_spline(x, y, k=3)` - B-spline
37 - `scipy.interpolate.interp1d(x, y, kind='cubic')` - 1D interpolation
38
394. **Validate Results**
40 - Check for Runge's phenomenon at boundaries (high-degree polynomials)
41 - Cross-validate: leave-one-out error estimation
42 - Visual inspection of interpolated curve
43 - `sympy_compute.py limit "interp_error" --at boundaries`
44
455. **High-Dimensional Considerations**
46 - Coxeter-Freudenthal-Kuhn triangulation for O(n log n) point location
47 - Barycentric subdivision for balanced performance
48
49
50## Tool Commands
51
52### Scipy_Cubic_Spline
53```bash
54uv run python -c "from scipy.interpolate import CubicSpline; import numpy as np; x = np.array([0,1,2,3]); y = np.array([0,1,4,9]); cs = CubicSpline(x, y); print(cs(1.5))"
55```
56
57### Scipy_Bspline
58```bash
59uv run python -c "from scipy.interpolate import make_interp_spline; import numpy as np; x = np.array([0,1,2,3]); y = np.array([0,1,4,9]); bspl = make_interp_spline(x, y, k=3); print(bspl(1.5))"
60```
61
62### Sympy_Lagrange
63```bash
64uv run python -m runtime.harness scripts/sympy_compute.py interpolate "[(0,0),(1,1),(2,4)]" --var x
65```
66
67## Key Techniques
68
69*From indexed textbooks:*
70
71- [An Introduction to Numerical Analysis... (Z-Library)] DISCUSSION OF THE LITERATURE Discussion of the Literature As noted in the introduction, interpolation theory is a foundation for the development of methods in numerical integration and differentiation, approxima tion theory, and the numerical solution of differential equations. Each of these· topics is developed in the following chapters, and the associated literature is discussed at that point. Additional results on interpolation theory are given in de Boor (1978), Davis (1963), Henrici (1982, chaps.
72- [Numerical analysis (Burden R.L., Fair... (Z-Library)] The most commonly used form of interpolation is piecewise-polynomial interpolation. If function and derivative values are available, piecewise cubic Hermite interpolation is recommended. This is the preferred method for interpolating values of a function that is the solution to a differential equation.
73- [Numerical analysis (Burden R.L., Fair... (Z-Library)] Copyright 2010 Cengage Learning. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
74- [Numerical analysis (Burden R.L., Fair... (Z-Library)] Galerkin and Rayleigh-Ritz methods are both determined by Eq. However, this is not the case for an arbitrary boundary-value problem. A treatment of the similarities and differences in the two methods and a discussion of the wide application of the Galerkin method can be found in [Schul] and in [SF].
75- [An Introduction to Numerical Analysis... (Z-Library)] Polynomial interpolation theory has a number of important uses. In this text, its primary use is to furnish some mathematical tools that are used in developing methods in the areas of approximation theory, numerical integration, and the numerical solution of differential equations. A second use is in developing means - for working with functions that are stored in tabular form.
76
77## Cognitive Tools Reference
78
79See `.claude/skills/math-mode/SKILL.md` for full tool documentation.
80
81---
82
83**Source:** [`parcadei/Continuous-Claude-v3`](https://github.com/parcadei/Continuous-Claude-v3) → `.claude/skills/math/numerical-methods/interpolation/SKILL.md`