HP Forums
HP 17BII: Trapezoid Rule Using Distinct Points - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: HP 17BII: Trapezoid Rule Using Distinct Points (/thread-13045.html)



HP 17BII: Trapezoid Rule Using Distinct Points - Eddie W. Shore - 05-30-2019 12:17 PM

Blog entry: http://edspi31415.blogspot.com/2019/05/hp-prime-and-hp-17bii-trapezoid-rule.html

We can estimate the area of any surface by the use of sums and integral. In calculus, we usually are given a function f(x), but here we are using measurements from one end to the other at various intervals.

Technically, the intervals between each measurement do not have to be equal length. However, having intervals of equal length makes things a lot easier, and in this blog entry, we assume they are.

We have various methods to estimate the area. One of the easiest ways is the Trapezoid Rule:

Area ≈ h/2 * ( y_1 + y_n + 2 * Σ( y_k , k, 2, n-1 ) )

Where:

h = interval length
y_k = length of each measurement, there are n measurements
y_1 and y_n: measurement of lengths at each end, respectively

First: define a SUM list named MS. The solver uses that list to get the reference measurements.

Solver:

Code:
AREAHGT: AREA = 0 * L(N:SIZES(MS)) + H÷2 * (ITEM(MS:1) + ITEM(MS:G(N)) + 2 * Σ(K:2: G(N)-1: 1: ITEM(MS:K) )

Example

h = 0.5

MS:
y_1 = 1174
y_2 = 1078
y_3 = 979
y_4 = 984
y_5 = 810
y_6 = 779
y_7 = 800
y_8 = 852
y_9 = 966

Area: 3676