#include <codecogs/maths/algebra/polynomial/poly_eval.h>
using namespace Maths::Algebra::Polynomial;
| double | polyEval (double x, const double coef[], int N) Evaluates a polynomial of degree N. | |
| Real | cc_polyEval (Real x, Range coef, Integer N) This function is available as a Microsoft Excel add-in. | |
| double | polyEval1 (double x, const double coef[], int N) Evaluates a polynomial of degree N, with | |
| Real | cc_polyEval1 (Real x, Range coef, Integer N) This function is available as a Microsoft Excel add-in. |
| doublepolyEval( | double | x | |
| const double* | coef | ||
| int | N | ) |
#include <stdio.h> #include <codecogs/maths/algebra/polynomial/poly_eval.h> int main() { using namespace Maths::Algebra::Polynomial; static double A[] = { 1,2,3 }; for(int x=2;x<=5;x++) printf("\n polyEval(%d, A, 2)=%.1lf", x, polyEval(x, A, 2)); return 0; }
polyEval(2, A, 2)=11.0 polyEval(3, A, 2)=18.0 polyEval(4, A, 2)=27.0 polyEval(5, A, 2)=38.0
| x | main variant |
| coef | array of coefficients coef[0..N] in reverse order[const] |
| N | degree of polynomial, also one less that number of coefficients supplied. |
| doublepolyEval1( | double | x | |
| const double* | coef | ||
| int | N | ) |
#include <stdio.h> #include <codecogs/maths/algebra/polynomial/poly_eval.h> int main() { using namespace Algebra::Polynomial; static double A[] = { -5, 4 }; for(int x=2;x<=5;x++) printf("\n polyEval1(%d, A, 2)=%.1lf", x, polyEval(x, A, 2)); return 0; }
polyEval1(2, A, 2)=-2.0 polyEval1(3, A, 2)=-2.0 polyEval1(4, A, 2)=0.0 polyEval1(5, A, 2)=4.0
| x | main variant |
| coef | array of coefficients coef[0..N-1] in reverse order[const] |
| N | degree of polynomial, also number of coefficients supplied. Must be 2 or more. |