proj home

Files   Classes   Functions   Hierarchy  

partialderivativetest.cpp

Go to the documentation of this file.
00001 
00002 #include <print.h>
00003 
00004 
00005 #include <partialderivativetest.h>
00006 
00007 #include <exploreh.h>
00008 #include <probsysequ01.h>
00009 #include <partialderivative.h>
00010 
00011 
00012 void partialderivativetest01()
00013 {
00014   cout << "This test is to solve a non-linear system of equations" << endl;
00015   cout << " numerically and terminate the approximation when the" << endl;
00016   cout << " parital derivatives become small." << endl;
00017   exploreh<probsysequ01,double*,double> g(2,0.2,50000);
00018 
00019   double x0[2] = { 0.5, 0.5 };
00020 
00021   g.reset(x0);
00022 
00023   g.print(cout);
00024 
00025   double zero = 1e-5;
00026   cout << "Iterate until the partial derivative are less than" << endl;
00027   cout << " " << zero << " in magnitude." << endl;
00028   bool valid=true;
00029 
00030   partialderivative< exploreh<probsysequ01,double*,double> > partiald(g);
00031 
00032   uintc kmax=30;
00033   for (uint i=0; valid; ++i)
00034   {
00035     for (uint k=0; k<kmax; ++k)
00036       ++g;
00037 
00038     partiald();
00039     if (zero > partiald.absvalue() )
00040       valid=false;
00041 
00042 cout << SHOW(i) << endl;
00043     //++g;
00044 
00045   }
00046 
00047   g.print(cout);
00048   cout << SHOW(g.fn.counter) << endl;
00049 
00050 }
00051 
00052 
00053 

Generated on Fri Mar 4 00:49:30 2011 for Chelton Evans Source by  doxygen 1.5.8