From 58bd132445c678610bcef82cf33ce6f964d705e4 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Thu, 24 Apr 2003 09:48:09 +0000 Subject: [PATCH] initial import --- Cantera/python/examples/function1.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Cantera/python/examples/function1.py diff --git a/Cantera/python/examples/function1.py b/Cantera/python/examples/function1.py new file mode 100644 index 000000000..d27e394cb --- /dev/null +++ b/Cantera/python/examples/function1.py @@ -0,0 +1,17 @@ +# This example shows how to create functions that are evaluated in C++ + +from Cantera.Func import * + +# create f1(t) = 4 + 6t + 8t^2 + t^3 +f1 = Polynomial([4.0, 6.0, 8.0, 1.0]) + +# create sin(t) +f2 = Fourier(1.0, [(0.0, 0.0), (0.0, 1.0)]) + +# create sin^2(t) +f3 = f2*f2 + +xpts = 0.1*array(range(100)) + +for x in xpts: + print x, f1(x), f2(x), f3(x)