Anonymous user
Numerical integration/Gauss-Legendre Quadrature: Difference between revisions
Numerical integration/Gauss-Legendre Quadrature (view source)
Revision as of 18:19, 13 July 2011
, 12 years ago→{{header|OCaml}}
(OCaml implementation) |
|||
Line 262:
let quadrature n f a b =
let f1 x = f ((x*.(b-.a) +. a +. b)*.0.5) in
let eval s (x,w) = s +. w*.(f1 x) in
0.5*.(b-.a)*.(List.fold_left
An example of how to use it:
<lang OCaml>let calc n =
|