```\ 5 point Gauss-Hermite integration

MARKER -gauss

needs ftran111.f

2.020182870456086e  FVARIABLE x2  x2  F!
0.958572464613819e  FVARIABLE x1  x1  F!
0e                  FVARIABLE x0  x0  F!
9.453087204829e-1   FVARIABLE w0  w0  F!
3.936193231522e-1   FVARIABLE w1  w1  F!
1.995324205905e-2   FVARIABLE w2  w2  F!

v: fdummy

: )int      ( f: -- integral)  ( xt --)   \ result left on fp stack
defines  fdummy
f" w0 * fdummy(x0) + w1 * (fdummy(x1) + fdummy(-x1))
+ w2 * (fdummy(x2) + fdummy(-x2)) "
;

FALSE [IF]

Examples:

10 set-precision  ok

use( fcos )int f. 1.380390076  ok   \ exact = 1.380388447043

: f1   f2*  fcos  ;  ok             \ cos(2x)
use( f1 )int f. .6532237524  ok     \ exact = 0.6520493321733

: f2   3e0 f*   fcos  ;  ok         \ cos(3x)
use( f2 )int f. .2246529014  ok     \ exact = 0.1868152614571

: f3   fcos  f^2  ;  ok             \ cos2(x)
use( f3 )int f. 1.212838802  ok     \ exact = 1.212251591539

: f4   f^2   fdup  -2e0  f+  f*  1e0 f+  ;  ok   \ x^4 - 2x^2 + 1
1e0 f4 f. .0000000000  ok
2e0 f4 f. 9.000000000  ok

use( f4 )int f. 1.329340388  ok     \ exact = 1.329340388179
[THEN]

```