liveBook · Manning

Vandermonde-like system

As explained in Geometry for Programmers

A Vandermonde system is a linear system whose coefficient matrix contains successive powers of distinct parameter or input values.

A Vandermonde-like system turns polynomial interpolation conditions into linear equations for unknown coefficients. For a parametric curve, choose parameter values for the guiding points, substitute them into the coordinate polynomials, and solve for the coefficients. The same system is solved independently for each coordinate. section 7.2.1

A practical workflow is:

  • Choose parameter values, such as evenly spaced values in the interval [0, 1], because point coordinates alone do not specify parameter correspondence. section 7.2.1
  • Write one linear system for each coordinate polynomial and solve for its coefficients. section 7.2.1
  • Reuse symbolic solutions when many point sets require curves with the same parameter pattern. section 7.2.1

Four points define a cubic parametric curve

Given four points, construct separate cubic polynomials Px(t) and Py(t). Solving their two four-equation systems produces eight coefficients and a curve passing through all four points. This interpolation is useful, but it gives limited control over endpoint tangent vectors; tangent-constrained systems provide that control instead. section 7.2.1

Listing 7.6 Getting the formula for the coefficients of a parametric polynomial curve
from sympy import *
 
ax, bx, cx, dx = symbols('ax bx cx dx')    #1
ay, by, cy, dy = symbols('ay by cy dy')    #2
x1, x2, x3, x4 = symbols('x1 x2 x3 x4')    #3
y1, y2, y3, y4 = symbols('y1 y2 y3 y4')    #4
 
x_system = [                               #5
    dx - x1,
    (1/27)*ax + (1/9)*bx + (1/3)*cx + dx - x2,
    (8/27)*ax + (4/9)*bx + (2/3)*cx + dx - x3,
    ax + bx + cx + dx - x4
]
 
y_system = [                               #6
    dy - y1,
    (1/27)*ay + (1/9)*by + (1/3)*cy + dy - y2,
    (8/27)*ay + (4/9)*by + (2/3)*cy + dy - y3,
    ay + by + cy + dy - y4
]
 
axs = solve(x_system, (ax, bx, cx, dx))
ays = solve(y_system, (ay, by, cy, dy))
 
print(axs)
print(ays)

A SymPy listing derives reusable coefficient formulas by declaring symbolic coefficients and solving the coordinate systems. section 7.2.1

The idea extends beyond one-variable curves: multivariate polynomials can also be placed in a Vandermonde-like system, where solving the resulting linear equations recovers their coefficients. section 8.1

How Geometry for Programmers covers it

How deep it goes
Explains parameter assignment, coordinate-wise systems, symbolic reuse, and tangent constraints, but does not develop matrix theory.
Examples
Uses four-point cubic curves, evenly spaced parameters on [0, 1], SymPy coefficient listings, and multivariate polynomial equations.
What it assumes
Assumes polynomial expressions and linear systems while introducing parameter correspondence and coordinate-wise interpolation.
What you can do after
Build it from scratch by assigning parameters, composing coordinate equations, and solving them for reusable polynomial coefficients.
How it connects
Connects polynomial interpolation, parametric curves, tangent vectors, splines, multivariate polynomials, and linear systems.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.