Showing posts with label Pedro Daniel Leiva. Show all posts
Showing posts with label Pedro Daniel Leiva. Show all posts

Monday, August 13, 2018

HP 35S: Trapezoid Analysis (Daniel Pedro Levia)


HP 35S: Trapezoid Analysis (Daniel Pedro Levia)

Have some time to squeeze in a post.  Much thanks to Daniel Pedro Levia.

Introduction

Given the trapezoid below:






The following are calculated:

Midsegment length:  (A + B)/2

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

Area:  M * H

You can see the HP Prime and Casio fx-CG50 programs here:  https://edspi31415.blogspot.com/2017/06/


HP 35S Program: Trapezoid – Pedro Daniel Leiva

Here is the program for the HP 35S, written by Pedro Daniel Levia.   The program is listed with permission of the author.

Variables Used:

R_A = length of side A
R_B = length of side B
R_C = length of side C
R_D = length of side D
R_H = height
R_M = mid-length
R_K = area
R_P = perimeter

Program:

T001 LBL T
T002 STO D
T003 R ↓
T004 STO C
T005 R ↓
T006 STO B
T007 R ↓
T008 STO A
T009 SQRT((-A+B+C+D)*(A-B+C+D)*(A-B+C-D)*(A-B-C+D))/(2*ABS(B-A)) // EQN
T010 STO H
T011 (A+B)/2  // EQN
T012 STO M
T013 STOP   // R/S
T014 RCL M
T015 RCL H
T016 ×
T017 STO K
T018 A+B+C+D  // EQN
T019 STO P
T020 RTN

20 steps

Instructions:  Enter the length of all four sides then run the program.

A [ENTER] B [ENTER] C [ENTER] D [XEQ] T [ENTER]

The height and midlength are shown first (Y and X stack, respectively).  Press [R/S] to get the area and perimeter.

Example:

A = 400
B = 350
C = 125
D = 106

Results:

Height:  104.3032
Midlength: 375.0000
Area:  39113.7186
Perimeter:  981.0000

  
Eddie


 All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Wednesday, August 8, 2018

HP 35S: Intersection Point of a Quadrilateral


HP 35S: Intersection Point of a Quadrilateral

Introduction

Let A, B, C, and D be four vertices of a quadrilateral, with two lines:

Line AC connects points A and C.
Line BC connects points B and D.



Designate the following points as:

A:  (ax, ay)
B:  (bx, by)
C:  (cx, cy)
D:  (dx, dy)

The center point (px, py) can be found by the following formulas:

px = (IBD – IAC)/(SAC – SBD)
py = SAC * px + IAC

Where:

Slope:
SAC = (cy – ay) / (cx – ax)
SBD = (dy – by) / (dx – bx)

Intercept:
IAC = ay – SAC * ax
IBD = by – SBD * bx

You can see the derivation of these formulas here:  https://edspi31415.blogspot.com/2017/08/geometry-intersection-point-of.html

Program  (Pedro Daniel Leiva)

The following program calculates the point – developed by Pedro Daniel Leiva. I used the recall arithmetic available on the HP 35S to shorten the program.  Program listed here with permission. 

Variables Used:

R_A = ax
R_B = ay
R_C = bx
R_D = by
R_E = cx
R_F = cy
R_G = dx
R_H = dy
R_I = SAC
R_J = SBD
R_K = IAC
R_L = IBD
R_P = px
R_Y = py

Program:

I001 LBL I
I002 SF 10
I003 ENTER XA^YA  \\ EQN
I004 STO B
I005 x<>y
I006 STO A
I007 ENTER XB^YB  \\ EQN
I008 STO D
I009 x<>y
I010 STO C
I011 ENTER XC^YC \\ EQN
I012 STO F
I013 x<>y
I014 STO E
I015 ENTER XD^YD  \\ EQN
I016 STO H
I017 x<>y
I018 STO G
I019 CF 10
I020 RCL F
I021 RCL - B     \\ [RCL] [ - ] ( B )
I022 RCL E
I023 RCL - A  \\ [RCL] [ - ]  ( A ) 
I024 ÷
I025 STO I
I026 STO P  \\ advanced storage to calculate px to save steps
I027 RCL× A
I028 +/-
I029 RCL+ B
I030 STO K
I031 RCL H
I032 RCL - D
I033 RCL G
I034 RCL – C
I035 ÷
I036 STO J
I037 STO – P
I038 RCL × C
I039 +/-
I040 RCL + D
I041 STO L
I042 RCL – K
I043 RCL ÷ P
I044 STO P
I045 ENTER
I046 RCL × I
I047 RCL + K
I048 STO Y
I049 x<>y
I050 RTN

50 steps

Instructions:

At each prompt, enter the x point, press [ENTER], enter the y point, press [ R/S ].  The result shows py on the Y stack, and px on the X stack.

Example:

A:  (0, 8)
B:  (11, 12)
C:  (10, 4)
D:  (3, 5)

Results:

py = 6.2353
px = 4.4118

Eddie


 All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...