- Why?
- I enjoy coding in JAVA and doing math.
- I hope you enjoy this too.
- What is interpolation?
- Interpolation is a method of estimating unknown values that fall between known values.
- It involves constructing new data points within the range of a discrete set of known data points.
- Intro to Polynomial Interpolation:
- Polynomial interpolation is a form of interpolation where the interpolant is a polynomial.
- Given a set of n+1 data points,
- Polynomial interpolation finds a polynomial of degree at most n that passes through all these points.
Hermite interpolation resources referenced in the implementation process can be found below under the References. This implementation of a Hermite interpolation is tested against NASA's I/O Example posted here. The final version of this interpolation calculator will hopefully return the entire interpolated polynomial and its derivative at given points. Any missing functionality is outlined by todo's within the code and will be added to issues soon.
Hermite interpolation is a type of polynomial interpolation where both the function values and the derivatives are matched at given points. This makes it particularly useful when the slope of the function is also known at the data points, providing a more accurate and smooth approximation (interpolation).
- Where the interpolating polynomial matches both function and derivates at given points (xi. yi) pairs.
- Abscissa x and Ordinate y
- Explanation summarized from this document
- i.e. Given (xi, yi, y'i), where i = 0,.., n number of inputs
- Determines a polynomial of least degree, denoted by:
$$H_{2n+1}(x) = \text{Hermite interpolated polynomial}$$
- Determines a polynomial of least degree, denoted by:
- The example provided along with the I/O specification of NASA's implementation slightly differs from the general approach. NASA performs the computation of only the Hermite interpolation value at a single point along with its derivative. It does not return the entire polynomial. This approach is suitable for their specific application of this interpolation method, likely due to the format of their inputs being time intervals (evenly spaced/uniform time steps).
- The inputs from NASA's example were fitted to match the parameters of my implementation by:
- NASA's Example: Uses
first
andstep
to generate equally spaced points.- Directly input the generated points into my implementation's
xi
array.
- Directly input the generated points into my implementation's
- NASA's Example: Interleaves function values and their derivatives in the
yvals
array.- Separate the function values and derivative values into
yi
andyprime
arrays, respectively.
- Separate the function values and derivative values into
- NASA's Example: Evaluates the interpolation at a specific point
x
.- Use the same point
x
to evaluate both the function value and its derivative using my implementation.
- Use the same point
- NASA's Example: Uses
- The general Hermite interpolation implementation was successfully validated against NASA's example, demonstrating that it can achieve the same results with different input formats. This flexibility allows the implementation to be used in a variety of scenarios, both with equally and unequally spaced data points.
This README provides a comprehensive overview of Hermite interpolation, including theoretical background, implementation details, and testing. If you need further modifications or have any questions, feel free to ask!
Run the NASA Test file test case 1. Read JAVA docs or the code to see how to call with your own data.
- TODO... Maven and JUnit instructions.