home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / ANUMR5.ZIP / SIMPTEST.C < prev    next >
C/C++ Source or Header  |  1991-01-13  |  589b  |  39 lines

  1. #include <math.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. #include "anum.h"
  6. #include "sysio.h"
  7.  
  8.  
  9.  
  10. double bf(double x)
  11.  
  12. {    return exp(3.0*x) + x*x/3.0; }
  13.  
  14.  
  15. void main(void)
  16.  
  17. {       double integ;
  18.  
  19.     int n=50;
  20.     double lb=1.0;
  21.     double ub=10.0;
  22.     int errcode;
  23.  
  24.     puts("Test for Simpson function\n"
  25.          "-------------------------\n");
  26.     printf("Lower bound : %lf\n",lb);
  27.     printf("Upper bound : %lf\n",ub);
  28.     printf("Number of intervals : %d\n",n);
  29.  
  30.     simpson(lb,ub,
  31.         n,
  32.         &integ,
  33.         &errcode,
  34.         bf);
  35.         SYSMSG(errcode,stderr);
  36.  
  37.     printf("Value               : %lf\n",integ);
  38. }
  39.