Polynomial interpolation using Chebyshev nodes with adaptive order selection, point merging for numerical stability, and graphical visualization using JFreeChart
Project_3
Numerical Methods For Digital Computing
Oklahoma State University
Due: 11-07-2025
Joshua Price
joshua.price@okstate.edu
Navigate to the src directory:
cd numerical-interpolation-visualizer/srcCompile and run:
Windows (Command Prompt or PowerShell):
javac -cp ".;../lib/*" *.java
java -cp ".;../lib/*" NIVMac/Linux:
javac -cp ".:../lib/*" *.java
java -cp ".:../lib/*" NIVDisclaimer: I am not sure that i handled the way lower-order Chebysheb polynomials using the Chebysheb nodes correctly. This program demonstrates Chebyshev polynomial interpolation with the following features:
Data Generation:
- Generates 6-8 random data points at Chebyshev nodes
- Chebyshev nodes are special x-coordinates on the interval [-1, 1] that minimize interpolation error
- Random y-values are generated in the range [-5, 5]
Point Merging:
- Points closer than a threshold distance are averaged together
- Uses Euclidean distance to detect close points
- Outputs which points were merged and the resulting averaged point
Adaptive Order Testing:
- Tests polynomial orders from 1 up to n-1
- Lower orders use a subset of points and approximate the full dataset
- Higher orders use more points and fit the data more closely
- The highest order passes through all points exactly
- Calculates and displays approximation error for each order
Graphical Visualization:
- Displays all data points as black dots
- Shows multiple colored curves representing different polynomial orders
- Each curve demonstrates how that polynomial order fits the data
This project uses JFreeChart for graphical representation of numerical data and function plotting.
JFreeChart was selected for two primary reasons:
-
Familiarity and reliability - I have extensive prior experience with JFreeChart for data visualization, though this is my first implementation of its graphical display capabilities for function plotting.
-
Precision and customization - The library provides the level of control necessary for a numerically sensitive application. JFreeChart allows fine-grained customization of data sampling, axis configuration, and display formatting, which is essential for accurately representing the results of numerical methods where precision is critical.
While alternative libraries exist for 2D graphing in Java (such as XChart, JMathPlot, and JavaFX), JFreeChart's combination of proven stability and extensive customization options makes it well-suited for this project's requirements.