public void TestLinear2DInterpolationErrorForWrongNumberOfInputs() { // arrange var interpolator = new LinearInterpolator(); var xVals = new List <double> { -2, -2 }; var yVals = new List <double> { -3, -3, 4 }; var interpolate = -2; // act/assert var result = interpolator.Interpolate2D(xVals, yVals, interpolate); }
public void TestLinear2dInterpolationBigToSmall() { // arrange var interpolator = new LinearInterpolator(); var xVals = new List <double> { 1, 2 }; var yVals = new List <double> { 2.1, -0.8 }; var interpolate = 1.2; // act var result = interpolator.Interpolate2D(xVals, yVals, interpolate); // assert Assert.AreEqual(1.52, result, 1e-6); }
public void TestLinear2dInterpolationSmallToBig() { // arrange var interpolator = new LinearInterpolator(); var xVals = new List <double> { -2, 1.5 }; var yVals = new List <double> { 3.2, 12.5 }; var interpolate = 0.5; // act var result = interpolator.Interpolate2D(xVals, yVals, interpolate); // assert Assert.AreEqual(9.842857, result, 1e-6); }
public void TestLinear2DInterpolationSamePoint() { // arrange var interpolator = new LinearInterpolator(); var xVals = new List <double> { -2, -2 }; var yVals = new List <double> { -3, -3 }; var interpolate = -2; // act var result = interpolator.Interpolate2D(xVals, yVals, interpolate); // assert Assert.AreEqual(-3, result); }
public void TestLinearInterpolation2DNoInterpolation() { // arrange var interpolator = new LinearInterpolator(); var xVals = new List <double> { 0, 5 }; var yVals = new List <double> { 2, 7 }; var interpolate = 5; // act var result = interpolator.Interpolate2D(xVals, yVals, interpolate); // assert Assert.AreEqual(7, result); }