/* simpsn.c */
/* simpsn.c
* Numerical integration of function tabulated
* at equally spaced arguments
*/
/* Coefficients for Cote integration formulas */
/* Note: these numbers were computed using 40-decimal precision. */
#define NCOTE 8
/* 6th order formula */
/*
static double simcon [ ] =
{
4 . 88095238095238095 E - 2 ,
2 . 57142857142857142857 E - 1 ,
3 . 2142857142857142857 E - 2 ,
3 . 2380952380952380952 E - 1 ,
} ;
*/
/* 8th order formula */
static double simcon[] =
{
3 .488536155202821869 E-2 ,
2 .076895943562610229 E-1 ,
-3 .27336860670194003527 E-2 ,
3 .7022927689594356261 E-1 ,
-1 .6014109347442680776 E-1 ,
};
/* 10th order formula */
/*
static double simcon [ ] =
{
2 . 68341483619261397039 E - 2 ,
1 . 77535941424830313719 E - 1 ,
- 8 . 1043570626903960237 E - 2 ,
4 . 5494628827962161295 E - 1 ,
- 4 . 3515512265512265512 E - 1 ,
7 . 1376463043129709796 E - 1 ,
} ;
*/
/* simpsn.c 2 */
/* 20th order formula */
/*
static double simcon [ ] =
{
1 . 182527324903160319 E - 2 ,
1 . 14137717644606974987 E - 1 ,
- 2 . 36478370511426964 E - 1 ,
1 . 20618689348187566 E + 0 ,
- 3 . 7710317267153304677 E + 0 ,
1 . 03367982199398011435 E + 1 ,
- 2 . 270881584397951229796 E + 1 ,
4 . 1828057422193554603 E + 1 ,
- 6 . 4075279490154004651555 E + 1 ,
8 . 279728347247285172085 E + 1 ,
- 9 . 0005367135242894657916 E + 1 ,
} ;
*/
/* simpsn.c 3 */
double simpsn( f, delta )
double f[]; /* tabulated function */
double delta; /* spacing of arguments */
{
extern double simcon[];
double ans;
int i;
ans = simcon[NCOTE/2 ] * f[NCOTE/2 ];
for ( i=0 ; i < NCOTE/2 ; i++ )
ans += simcon[i] * ( f[i] + f[NCOTE-i] );
return ( ans * delta * NCOTE );
}
Messung V0.5 in Prozent C=83 H=82 G=82
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-17)
¤
*© Formatika GbR, Deutschland