QuadraticCalc

Quadratic Spline Calculator

Connect data points with a smooth chain of parabolas, and get the equation of each piece.

Your Values

At least 3 points with different x values

Try an example

Visualization

Results

Step-by-Step Solution

    How Quadratic Spline Calculator Works?

    The quadratic spline calculator sorts the points, makes the first piece a straight line, and carries the slope across each knot with zᵢ₊₁ = −zᵢ + 2(yᵢ₊₁ − yᵢ)/(xᵢ₊₁ − xᵢ) to build 1 parabola per interval.

    1. Enter at least 3 points
    2. Sort the points by x
    3. Set the first slope z₀
    4. Compute the slope zᵢ at each knot
    5. Build each piece Sᵢ(x)
    6. Draw each piece in its own colour

    A spline with n + 1 points has n pieces and 3n unknown coefficients. Passing through the points and matching slopes give 3n − 1 conditions, and the straight first piece supplies the last one.

    Quadratic Spline Formula

    The quadratic spline formula is Sᵢ(x) = Aᵢ(x − xᵢ)² + zᵢ(x − xᵢ) + yᵢ, with Aᵢ = (zᵢ₊₁ − zᵢ) / (2(xᵢ₊₁ − xᵢ)).

    Sᵢ(x) = Aᵢ(x − xᵢ)² + zᵢ(x − xᵢ) + yᵢ
    zᵢ
    slope at knot i
    Aᵢ
    (zᵢ₊₁ − zᵢ) / (2(xᵢ₊₁ − xᵢ))
    zᵢ₊₁
    −zᵢ + 2(yᵢ₊₁ − yᵢ)/(xᵢ₊₁ − xᵢ)
    z₀
    (y₁ − y₀)/(x₁ − x₀), first piece linear

    For the points (0, 1), (1, 3), (2, 2) and (4, 5), the slopes are 2, 2, −4 and 7, and the 3 pieces are 2x + 1, −3x² + 8x − 2 and 2.75x² − 15x + 21.

    Quadratic Spline Calculator FAQ

    What Is the Difference Between a Quadratic Spline and a Cubic Spline?

    A quadratic spline matches the slope at each knot, and a cubic spline matches the slope and the curvature, which gives a smoother curve.

    Why Is the First Piece of the Spline a Straight Line?

    The conditions leave 1 free choice, and a linear first piece (A₁ = 0) is the standard choice in numerical methods textbooks.

    How Many Points Does a Quadratic Spline Need?

    A quadratic spline needs at least 3 points, and the calculator accepts up to 40.

    Is a Quadratic Spline Smooth?

    Yes, a quadratic spline has a continuous slope with no corners, but its curvature can jump at the knots.

    Do I Need to Enter the Points in Order?

    No, the calculator sorts the points by x before building the spline.