C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow
2014-11-03 21:36:41 +11:00
parent af8fd04155
commit d068f6e14b
4 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,7 @@ template <typename T>
void polynomial()
{
std::string expression_string = "25x^5 - 35x^4 - 15x^3 + 40x^2 - 15x + 1";
T r0 = T(0);
T r1 = T(1);
T x = T(0);
@ -39,6 +40,7 @@ void polynomial()
parser.compile(expression_string,expression);
const T delta = T(1.0 / 100.0);
for (x = r0; x <= r1; x += delta)
{
printf("%19.15f\t%19.15f\n",x,expression.value());