Post Reply 
Trapezoid Rule Using Distinct Points
05-30-2019, 12:12 PM
Post: #1
Trapezoid Rule Using Distinct Points
Blog Link: http://edspi31415.blogspot.com/2019/05/h...-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

Another rule to estimate area is the Simpson's Rule:

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

The program presented here uses the Trapezoid Rule.

HP Prime Program AREAHGT

Two arguments: h, a list of measurements
Code:

EXPORT AREAHGT(h, ms)
BEGIN
// h:  increment between measurements
// ms: list of measurements
// 2019-05-09 EWS
LOCAL k,n:=SIZE(ms);
RETURN h/2 * (ms(1) + ms(n) + 2 * Σ( ms(k), k, 2, n-1 ));
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: