Skip to content

Commit ffe0f5f

Browse files
added Langrange Polynomial Interpolation Documentation by Timothy Kandiado
1 parent caa1509 commit ffe0f5f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/math/interpolation.rs

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pub fn linear_interpolation(x: f64, point0: (f64, f64), point1: (f64, f64)) -> f
77
point0.1 + (x - point0.0) * (point1.1 - point0.1) / (point1.0 - point0.0)
88
}
99

10+
/// In numerical analysis, the Lagrange interpolating polynomial
11+
/// is the unique polynomial of lowest degree that interpolates a given set of data.
12+
///
13+
/// Source: https://en.wikipedia.org/wiki/Lagrange_polynomial
14+
/// Source: https://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html
1015
pub fn langrange_polynomial_interpolation(x: f64, defined_points: &Vec<(f64, f64)>) -> f64 {
1116
let mut defined_x_values: Vec<f64> = Vec::new();
1217
let mut defined_y_values: Vec<f64> = Vec::new();

0 commit comments

Comments
 (0)