Exemple #1
0
/* >>>>>>>>>> EXA12_2 <<<<<<<<<< */
void exa12_2 (void)
{ float p = 3.14159f, step;
  
   setpag ("da4p");
   disini ();
   pagera ();
   hwfont ();
   axspos (200, 2400);
   axslen (1800, 1800);
   intax  ();

   titlin ("Surface Plot of the Parametric Function", 2);
   titlin ("[COS(t)+(3+COS(u)), SIN(t)*(3+COS(u)), SIN(u)]", 4);

   name   ("X-axis", "x");
   name   ("Y-axis", "y");
   name   ("Z-axis", "z");

   vkytit (-300);
   zscale (-1.f, 1.f);
   graf3d (-4.f, 4.f, -4.f, 1.f, -4.f, 4.f, -4.f, 1.f,
	   -3.f, 3.f, -3.f, 1.f);
   height (40);
   title  ();

   surmsh ("on");
   step = (float) (2 * 3.14159 / 30.);
   surfcp (zfun, 0.f, 2 * p, step, 0.f, 2 * p, step);
   disfin ();
}
Exemple #2
0
void
test_predict
(void)
{

   double case1[5] = {
      0.0, 0.0, 0.0, 0.0, 0.0
   };

   test_assert(fabs(predict(zscale(case1)) + 2.101421) < 1e-4);

   double case2[5] = {
      0.1, 0.2, 0.3, 0.4, 0.5
   };

   test_assert(fabs(predict(zscale(case2)) + 0.164167) < 1e-4);

   double case3[5] = {
      0.04336188,  3.972419, 6.960893e-03, 0.15916909, 0.8062380
   };

   test_assert(fabs(predict(zscale(case3)) - 0.319410) < 1e-4);

}