A guide for selecting and implementing interpolation methods in numerical analysis using SciPy.

Install

mkdir -p .claude/skills/interpolation && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3005" && unzip -o skill.zip -d .claude/skills/interpolation && rm skill.zip

Installs to .claude/skills/interpolation

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Problem-solving strategies for interpolation in numerical methods
65 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Select interpolation methods based on data point count
  • Implement cubic splines and B-splines using SciPy
  • Perform polynomial interpolation with Lagrange or Newton methods
  • Validate results for Runge's phenomenon at boundaries
  • Apply Coxeter-Freudenthal-Kuhn triangulation for high-dimensional data

How it works

The skill selects an interpolation strategy based on data characteristics like noise and point density, then applies specific SciPy or SymPy functions to compute the result.

Inputs & outputs

You give it
Numerical data points (x, y)
You get back
Interpolated function or specific value

When to use interpolation

  • Interpolating smooth data points
  • Handling noisy datasets
  • Selecting between polynomial and spline methods

About this skill

Interpolation

When to Use

Use this skill when working on interpolation problems in numerical methods.

Decision Tree

  1. Assess Data Characteristics

    • How many data points? Spacing uniform or non-uniform?
    • Is data smooth or noisy?
    • Need derivatives at endpoints?
  2. 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)
  3. 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
  4. 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
  5. 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.

When not to use it

  • When data is high-dimensional and requires simplex-based methods
  • When boundary derivative values are unavailable for Hermite interpolation

Prerequisites

SciPyNumPySymPy

Limitations

  • High-degree polynomials may suffer from Runge's phenomenon at boundaries
  • Requires specific handling for noisy datasets using smoothing splines

How it compares

Unlike manual implementation, this skill provides a decision tree to match data properties with the appropriate numerical method.

Compared to similar skills

interpolation side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
interpolation (this skill)17moReviewIntermediate
quant-analyst1032moNo flagsAdvanced
umap-learn62moReviewIntermediate
embedding-strategies82moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

quant-analyst

zenobi-us

Expert quantitative analyst specializing in financial modeling, algorithmic trading, and risk analytics. Masters statistical methods, derivatives pricing, and high-frequency trading with focus on mathematical rigor, performance optimization, and profitable strategy development.

103355

umap-learn

K-Dense-AI

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

6100

embedding-strategies

wshobson

Select and optimize embedding models for semantic search and RAG applications. Use when choosing embedding models, implementing chunking strategies, or optimizing embedding quality for specific domains.

890

building-automl-pipelines

jeremylongshore

Build automated machine learning pipelines, including feature engineering, model selection, and performance evaluation.

688

model-compare

rawwerks

Compare 3D CAD models using boolean operations (IoU, Dice, precision/recall). Use when evaluating generated models against gold references, diffing CAD revisions, or computing similarity metrics for ML training. Triggers on: model diff, compare models, IoU, intersection over union, model similarity, CAD comparison, STEP diff, 3D evaluation, gold reference, generated model, precision recall 3D.

783

matchms

davila7

Mass spectrometry analysis. Process mzML/MGF/MSP, spectral similarity (cosine, modified cosine), metadata harmonization, compound ID, for metabolomics and MS data processing.

674

Search skills

Search the agent skills registry