Difference in cubic spline formula

In summary, the two forms of the cubic spline equations are both mathematically correct, but the first form may be more convenient for proofs.
  • #1
zzmanzz
54
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
  • #2
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.
 
  • #3
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.
 

Related to Difference in cubic spline formula

What is a cubic spline formula?

A cubic spline formula is a mathematical function used to interpolate or approximate a smooth curve between a series of data points. It is often used in computer graphics, engineering, and scientific applications.

How is a cubic spline formula different from other interpolation methods?

Unlike other interpolation methods, such as linear interpolation, a cubic spline formula uses a piecewise function that consists of multiple cubic polynomials joined together at specific points. This allows for a smoother and more accurate representation of the data.

What are the advantages of using a cubic spline formula?

One major advantage of using a cubic spline formula is that it can accurately capture the shape of the data without necessarily passing through all the data points. It also produces a smoother curve compared to other interpolation methods, making it useful for generating visually appealing graphs.

What are the limitations of a cubic spline formula?

One limitation of a cubic spline formula is that it requires more computation and memory compared to other interpolation methods, which can be a problem for large datasets. It also assumes that the data is continuous and does not work well with discontinuous or noisy data.

In what fields is the cubic spline formula commonly used?

The cubic spline formula is commonly used in fields such as computer graphics, engineering, and scientific research. It is also used in data analysis and curve fitting to estimate values between known data points.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
574
  • Calculus and Beyond Homework Help
Replies
2
Views
638
  • Calculus and Beyond Homework Help
2
Replies
43
Views
3K
  • Calculus and Beyond Homework Help
Replies
4
Views
357
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
1K
Replies
1
Views
1K
Back
Top