I have recently been doing some research on flight and aerodynamics for a project that’s in the pipeline, in particular how to calculate lift under varying conditions. According to Wikipedia:
“The total Lift force is the integral of vertical pressure forces over the entire wetted surface area of the wing.”
This got me wondering about how to calculate the definite integral of a function programatically, so I wrote this program which aproximates the area under a curve to a given degree of accuracy by breaking the area up into a number of trapezoids.
Source: integral.cpp (3.0 KB)
This post is now [3 July 2008] the most popular on the whole blog. If you find it helpful (or not) please leave a comment. Thanks.