Category : C Source Code
Archive   : RECIPEX.ZIP
Filename : XQTRAP.C

 
Output of file : XQTRAP.C contained in archive : RECIPEX.ZIP
/* Driver for routine QTRAP */

#include
#include
#include "nr.h"

#define PIO2 1.5707963

/* Test function */
float func(x)
float x;
{
return x*x*(x*x-2.0)*sin(x);
}

/* Integral of test function */
float fint(x)
float x;
{
return 4.0*x*(x*x-7.0)*sin(x)-
(pow(x,4.0)-14.0*x*x+28.0)*cos(x);
}

main()
{
float a=0.0,b=PIO2,s;

printf("Integral of func computed with QTRAP\n\n");
printf("Actual value of integral is %12.6f\n",fint(b)-fint(a));
s=qtrap(func,a,b);
printf("Result from routine QTRAP is %12.6f\n",s);
}


  3 Responses to “Category : C Source Code
Archive   : RECIPEX.ZIP
Filename : XQTRAP.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/