06-24-2017, 02:32 AM

The program TRAPEZ calculates the following:

Midsegment length: M = (A + B)/2

Height: H = √( (-A+B+C+D)(A-B+C+D)(A-B+C-D)(A-B-C+D) )/(2 * abs(B-A))

Area: K = M * H

HP Prime Program TRAPEZ

Example

A = 13, B = 23, C = 6, D = 7

Results:

Midlength, M = 18

Height, H = 4.139493194

Area, A = 74.3848775

Source:

“Trapezoid” Wikipedia. Edited July 7, 2014. Retrieved July 8, 2014

Current page:

Midsegment length: M = (A + B)/2

Height: H = √( (-A+B+C+D)(A-B+C+D)(A-B+C-D)(A-B-C+D) )/(2 * abs(B-A))

Area: K = M * H

HP Prime Program TRAPEZ

Code:

EXPORT TRAPEZ()

BEGIN

// trapezoid

// 2017-06-23 EWS

INPUT({A,B,C,D},

"Trapezoid",

{"a: ","b: ","c: ","d: "},

{"Top","Bottom","Left","Right"});

M:=(A+B)/2;

I:=(−A+B+C+D)*(A-B+C+D)*(A-B+C-D)*

(A-B-C+D);

IF I≤0 THEN

PRINT();

PRINT("Invalid Trapezoid");

ELSE

H:=√(I)/(2*ABS(B-A));

K:=H*M;

PRINT();

PRINT("Midlength = "+M);

PRINT("Height = "+H);

PRINT("Area = "+K);

END;

END;

Example

A = 13, B = 23, C = 6, D = 7

Results:

Midlength, M = 18

Height, H = 4.139493194

Area, A = 74.3848775

Source:

“Trapezoid” Wikipedia. Edited July 7, 2014. Retrieved July 8, 2014

Current page: