test_lambda.cpp

00001 #include <FunDef.h>
00002 
00003 using namespace std;
00004 
00005 int main() {
00006 
00007     Sym x = SymVar(0);
00008     Sym y = SymVar(1);
00009 
00010     Sym f = y + x*x;
00011 
00012     Sym l = SymLambda(f);
00013     
00014     SymVec args = l.args();
00015     args[0] = x;
00016     args[1] = y;
00017     l = Sym(l.token(), args);
00018     
00019     vector<double> v(3);
00020     v[0] = 2.0;
00021     v[1] = 3.0;
00022     v[2] = 4.0;
00023 
00024     double v1 = eval(f,v);
00025     double v2 = eval(l,v);
00026 
00027     cout << v1 << ' ' << v2 << endl;
00028     cout << f << endl;
00029     cout << l << endl;
00030 
00031     if (v1 != 7.0) return 1;
00032     if (v2 != 11.0) return 1;
00033 }
00034 

Generated on Thu Oct 19 05:06:44 2006 for EO by  doxygen 1.3.9.1