Posted February 23, 2012
by Lensyl Urbano
This is an attempt to illustrate numerical integration by animating an HTML5's canvas.
We're trying to find the area between x = 1
and x = 5
, beneath the parabola:
By integrating, the area under the curve can be calculated as being 17 ⅔ (see below for the analytical solution). For numerical integration, however, the area under the curve is filled with trapezoids and the total area is calculated from the sum of all the areas. As you increase the number of trapezoids, the approximation becomes more accurate. The reduction in the error can be seen on the graph: with 1 trapezoid there is a large gap between the shaded area and the curve; more trapezoids fill in the gap better and better.
The table below show how the error
(defined as the difference between the calculation using trapezoids and the analytic solution) gets smaller with increasing numbers of trapezoids (n
|Number of trapezoids
||Error (difference from 17.66)
The area under the curve, between x = 1
and x = 5
can be figured out analytically by integrating between these limits.
(See also WolframAlpha's solution
Demonstration of this numerical integration using four trapezoids in embeddable graphs
Citing this post: Urbano, L., 2012. Numerical Integration, Retrieved February 23rd, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.