Numerical integration/Gauss-Legendre Quadrature: Difference between revisions
Numerical integration/Gauss-Legendre Quadrature (view source)
Revision as of 20:48, 11 September 2011
, 12 years ago→{{header|Maxima}}: task example
m (→{{header|Maxima}}: task example) |
|||
Line 241:
h: bfloat((b - a)/2),
h*sum(w[i]*bfloat(f(c + x[i]*h)), i, 1, n))$
fpprec: 40$
gauss_int(lambda([x], 4/(1 + x^2)), 0, 1, 20);
Line 248 ⟶ 250:
% - bfloat(%pi);
/* -3.427286956499858315999116083264403489053b-27 */
gauss_int(exp, -3, 3, 5);
/* 2.003557771838556215392853572527509393154b1 */
% - bfloat(integrate(exp(x), x, -3, 3));
/* -1.721364342416440206515136565621888185351b-4 */</lang>
=={{header|OCaml}}==
|