Files Classes Functions Hierarchy
00001 #include <iostream> 00002 using namespace std; 00003 00004 #include <print.h> 00005 #include <powerseries1D.h> 00006 #include <powerseriesWD.h> 00007 00008 #include <powerseriestest.h> 00009 00010 void powerseriestest::test01() 00011 { 00012 cout << "Power series test" << endl; 00013 00014 double az[4] = {1.0,2.0,3.0,4.0}; 00015 00016 powerseries1D<double> f(az,4); 00017 00018 double y; 00019 cout << "Expect 10" << endl; 00020 f(y,1.0); 00021 cout << SHOW(y) << endl; 00022 cout << "Expect 49" << endl; 00023 f(y,2.0); 00024 cout << SHOW(y) << endl; 00025 cout << endl; 00026 cout << "Testing the function another way." << endl; 00027 cout << SHOW(f(2.0)) << endl; 00028 f.differentiate(); 00029 for (uint i=0; i<4; ++i) 00030 { 00031 cout << f.ai[i] << "*t^" << i << "+"; 00032 } 00033 00034 } 00035 00036 void powerseriestest::test02() 00037 { 00038 uintc N(4); 00039 uintc W(2); 00040 double az[W*N] = 00041 { 00042 1.0, 2.0, 3.0, 4.0, 00043 3.0, -7.0, 4.5, 0.0 00044 }; 00045 00046 powerseriesWD<double> f(az,W,N); 00047 00048 double y; 00049 cout << "Expect 10" << endl; 00050 f.currentSet(0); 00051 f(y,1.0); 00052 cout << SHOW(y) << endl; 00053 00054 f.currentSet(1); 00055 f(y,1.0); 00056 cout << SHOW(y) << endl; 00057 } 00058 00059 00060
1.5.8