diff --git a/eo/contrib/mathsym/GNUmakefile b/eo/contrib/mathsym/GNUmakefile index 7da7683d5..47235658b 100644 --- a/eo/contrib/mathsym/GNUmakefile +++ b/eo/contrib/mathsym/GNUmakefile @@ -39,7 +39,7 @@ libsym.a: $(OBJS) rm libsym.a; ar cq $(SYMLIB) $(OBJS) check: $(TESTPROGRAMS) - test/test_compile && test/testeo && test_simplify && echo "all tests succeeded" + test/test_compile && test/testeo && test/test_simplify && test/test_diff && echo "all tests succeeded" test/test_compile: test/test_compile.o ${SYMLIB} $(CXX) -o test/test_compile test/test_compile.o $(SYMLIB) ${LIBS} diff --git a/eo/contrib/mathsym/test/test_diff.cpp b/eo/contrib/mathsym/test/test_diff.cpp new file mode 100644 index 000000000..09dd292d4 --- /dev/null +++ b/eo/contrib/mathsym/test/test_diff.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +using namespace std; + +int main() { + + Sym v = SymConst(1.2); + + Sym g = exp(-sqr(v)); + + cout << g << endl; + cout << differentiate(g, v.token()) << endl; + +} + diff --git a/eo/contrib/mathsym/test/test_simplify.cpp b/eo/contrib/mathsym/test/test_simplify.cpp new file mode 100644 index 000000000..73c94c59c --- /dev/null +++ b/eo/contrib/mathsym/test/test_simplify.cpp @@ -0,0 +1,18 @@ + +#include + +using namespace std; + +int main() { + + Sym c1 = SymConst(0.4); + Sym c2 = SymConst(0.3); + Sym v1 = SymVar(0); + + Sym expr = (c1 + c2) * ( (c1 + c2) * v1); + + cout << expr << endl; + cout << simplify(expr) << endl; + +} + diff --git a/eo/contrib/mathsym/test/testeo.cpp b/eo/contrib/mathsym/test/testeo.cpp index 8693bd164..a15303cb0 100644 --- a/eo/contrib/mathsym/test/testeo.cpp +++ b/eo/contrib/mathsym/test/testeo.cpp @@ -102,7 +102,7 @@ int main() { cout << "****** Evaluation **********" << endl; Dataset dataset; - dataset.load_data("problem4.dat"); + dataset.load_data("test_data.txt"); IntervalBoundsCheck check(dataset.input_minima(), dataset.input_maxima()); ErrorMeasure measure(dataset, 0.90, ErrorMeasure::mean_squared_scaled);