/// <summary> /// Evaluate a complex Chebyshev polynomial on an interval, given the coefficients. /// </summary> /// <param name="cs">The coefficients to consider.</param> /// <param name="z">The complex evaluation argument.</param> /// <returns>The value.</returns> public static ScalarValue ChebEval(ChebSeries cs, ScalarValue z) { var d = ScalarValue.Zero; var dd = ScalarValue.Zero; var y = (2.0 * z - cs.LowerPoint - cs.UpperPoint) / (cs.UpperPoint - cs.LowerPoint); var y2 = 2.0 * y; for (var j = cs.Order; j >= 1; j--) { var temp = d; d = y2 * d - dd + cs.Coefficients[j]; dd = temp; } return(y * d - dd + 0.5 * cs.Coefficients[0]); }
/// <summary> /// Evaluate a real Chebyshev polynomial on an interval, given the coefficients. /// </summary> /// <param name="cs">The coefficients to consider.</param> /// <param name="x">The real evaluation argument.</param> /// <returns>The value.</returns> public static Double ChebEval(ChebSeries cs, Double x) { var d = 0.0; var dd = 0.0; var y = (2.0 * x - cs.LowerPoint - cs.UpperPoint) / (cs.UpperPoint - cs.LowerPoint); var y2 = 2.0 * y; for (var j = cs.Order; j >= 1; j--) { var temp = d; d = y2 * d - dd + cs.Coefficients[j]; dd = temp; } return(y * d - dd + 0.5 * cs.Coefficients[0]); }
/// <summary> /// Evaluate a real Chebyshev polynomial on an interval, given the coefficients. /// </summary> /// <param name="cs">The coefficients to consider.</param> /// <param name="x">The real evaluation argument.</param> /// <returns>The value.</returns> public static double ChebEval(ChebSeries cs, double x) { int j; double d = 0.0; double dd = 0.0; double y = (2.0 * x - cs.LowerPoint - cs.UpperPoint) / (cs.UpperPoint - cs.LowerPoint); double y2 = 2.0 * y; for (j = cs.Order; j >= 1; j--) { double temp = d; d = y2 * d - dd + cs.Coefficients[j]; dd = temp; } return(y * d - dd + 0.5 * cs.Coefficients[0]); }
/// <summary> /// Evaluate a complex Chebyshev polynomial on an interval, given the coefficients. /// </summary> /// <param name="cs">The coefficients to consider.</param> /// <param name="z">The complex evaluation argument.</param> /// <returns>The value.</returns> public static ScalarValue ChebEval(ChebSeries cs, ScalarValue z) { var d = ScalarValue.Zero; var dd = ScalarValue.Zero; var y = (2.0 * z - cs.LowerPoint - cs.UpperPoint) / (cs.UpperPoint - cs.LowerPoint); var y2 = 2.0 * y; for (var j = cs.Order; j >= 1; j--) { var temp = d; d = y2 * d - dd + cs.Coefficients[j]; dd = temp; } return y * d - dd + 0.5 * cs.Coefficients[0]; }
/// <summary> /// Evaluate a real Chebyshev polynomial on an interval, given the coefficients. /// </summary> /// <param name="cs">The coefficients to consider.</param> /// <param name="x">The real evaluation argument.</param> /// <returns>The value.</returns> public static Double ChebEval(ChebSeries cs, Double x) { var d = 0.0; var dd = 0.0; var y = (2.0 * x - cs.LowerPoint - cs.UpperPoint) / (cs.UpperPoint - cs.LowerPoint); var y2 = 2.0 * y; for (var j = cs.Order; j >= 1; j--) { var temp = d; d = y2 * d - dd + cs.Coefficients[j]; dd = temp; } return y * d - dd + 0.5 * cs.Coefficients[0]; }