Mechanics of Materials

This appendix describes simple numerical techniques for evaluating the value of an integral, determining a root of a nonlinear equation, and finding constants of a polynomial by the least-squares method. Algorithms are given that can be programmed in any language. Also shown are methods of solving the same problems using a spreadsheet. If there are no other curriculum or pedagogical considerations, the author would recommend the use of spreadsheets based on the observation that spreadsheets are as ubiquitous as word processors and are easy to learn and use.
We seek to numerically evaluate the integral
where the function f(x) and the limits a and b are assumed known.
This integral represents the area underneath the curve f(x) in the interval defined by x = a and x = b. The interval between a and b can be subdivided into N parts, as shown in Figure B.1. In each of the subintervals the function can be approximated by a straight-line segment. The area under the curve in each subinterval is the area of a trapezoid. Thus in the ith interval the area is ( ?x i)[ f(x i)+ f(x i?1)]/2. By summing all the areas we obtain an approximate value of the total area represented by the integral in Equation (B.1),
By increasing the value of N in Equation (B.2) we can improve the...