Difference in cubic spline formula

Click For Summary
SUMMARY

The discussion focuses on the differences between two formulations of natural cubic spline equations: s(x) = a + bx + cx^2 + dx^3 and s(x) = a + b(x - t) + c(x - t)^2 + d(x - t)^3. Both forms are mathematically valid, but the second formulation, which uses the distance (x - t), offers better numerical stability and avoids round-off errors when evaluating derivatives. The choice of formulation depends on the context and the desired convenience for proofs or numerical evaluation.

PREREQUISITES
  • Understanding of cubic spline interpolation
  • Familiarity with polynomial equations
  • Knowledge of numerical stability concepts
  • Basic calculus for evaluating derivatives
NEXT STEPS
  • Research "Cubic Spline Interpolation" techniques in numerical analysis
  • Learn about "Numerical Stability" in computational mathematics
  • Explore "Polynomial Derivatives" and their applications
  • Investigate "Parameter Normalization" methods in spline fitting
USEFUL FOR

Mathematicians, data scientists, engineers, and anyone involved in numerical analysis or spline interpolation techniques will benefit from this discussion.

zzmanzz
Messages
47
Reaction score
0

Homework Statement



Hi, this is more of a review question and I'm just looking at solutions of natural cubic spline equations and some will give the cubic spline as:

1. s(x) = a + bx + cx^2 + dx^3

on Wolfram

while other pages will give:

2. s(x) = a + b(x - t) + c(x-t)^2 + d(x-t)^3

where t is the first coordinate in the each point given. I'm not sure which is the standard version and it can make a difference when I evaluate the derivatives so any clarification is appreciated.
 
Physics news on Phys.org
As I didn't know the term cubic spline, I looked it up on Wikipedia and found
$$
c(t)=(2p_0-2p_1+m_0+m_1)t^3 + (-3p_0+3p_1-2m_0-m_1)t^2+m_0t+p_0=(2t^3-3t^2+1)p_0+(-2t^3+3t^2)p_1+(t^3-2t^2+t)m_0+(t^3-t^2)m_1
$$
so the answer seems to be: both, depending on how you would like to interpret and group the coefficients.
 
It's all how you want to parametrize the spline. The first form may be more convenient for proofs, defining each in terms of the same ##x##. But when you evaluate that, as ##x## gets larger and larger, so do ##x^2## and ##x^3## and you're going to be dealing with small differences between large numbers. It's mathematically correct and gives the right answer theoretically, but might lead to some round-off errors in actually evaluating.

The second form is in terms of the distance ##(x - t)## from the last point. It won't have the problem of numerical stability because ##(x - t)## will never get very large.

In fact I've often used a normalized parameter ##(x - x_i)/(x_{i+1}-x_i)## which ranges from 0 at the beginning of each interval to 1 at the end of the interval. I've found that makes the derivations and resulting equations extremely easy.

Since all of these things are linear in ##x##, if expanded and simplified they should all lead to the same polynomials given the same constraints.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
6
Views
3K
Replies
1
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
1K
Replies
3
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K