Showing posts with label intersection point. Show all posts
Showing posts with label intersection point. Show all posts

Sunday, September 23, 2018

HP 48G: Stefanescu Horatiu: Intersection of the Diagonals of a Quadrilateral

HP 48G:  Stefanescu Horatiu:  Intersection of the Diagonals of a Quadrilateral

The following program, written by Stefanescu Horatiu, calculates the intersection point of the two diagonals of a quadrilateral (partulator in Romanian). 



The program takes place in a directory PATRULATERDIAGONALE.  In order to type in the program, you will need to create a directory by using the CRDIR command. 

This program also works on the HP 49G series (48gii, 49G, 49g+) and the HP 50g. 

HP 48G Program PATRULATERDIAGONALE - Stefanescu Horatiu

Note:  You are going to notice how all the subroutines flow together, as the first program calls the next program. You will need to enter and store all the programs for the entire routine to work correctly.

On a personal note, I like how the text is spelled out one letter at time.  Hoartiu accomplishes this by using a FOR-NEXT structure which includes the commands 1 I  SUB 1 DISP.  (with I as the counter variable).

The text of the program is in Romanian. 

The program is presented here with permission from the author, with full credit going  to Stefanescu Horatiu.  I thank Horatiu in allowing me to feature his work on my blog.

STARTDIAGONALE:

<< CLEAR CLLCD 1 110 FOR I
"ACEST PROGRAM CALCUL
EAZA COORDONATELE PUN
CTULUI DE INTERSECTIE
A DIAGONALELOR UNUI
PATRULATER OARECARE."
1 I SUB 1 DISP
NEXT 0 WAIT
INTRODUCERE >>

INTRODUCERE:  (User input screen)

<< CLLCD 
"COORDONATE PATRULATER"
{"Ax" "Ay" "Bx"
"By" "Cx" "Cy" "Dx"
"Dy" } { 2 4 } { }
{ } INFORM DROP
OBJ→ DROP 'DY' STO
'DX' STO 'CY' STO
'CX' STO 'BY' STO
'BX' STO 'AY' STO
'AX' STO CLLCD
EMURILE >>

EMURILE:  (the start of the calculation routines)

<< 'CY-AY' →NUM 'M1' STO 
'-AX*(CY-AY)' →NUM 'M2' STO 
'CX-AX' →NUM 'M3' STO
'-AY*(CX-AX)' →NUM 'M4' STO
ENURILE >>

ENURILE:

<< 'BY-DY' →NUM 'N1' STO
'-DX*(BY-DY)' →NUM 'N2' STO
'BX-DX' →NUM 'N3' STO
'-DY*(BX-DX)' →NUM 'N4' STO
ESURILE >>

ESURILE:

<< 'N1-N3*M1/M3' →NUM 'S1' STO
'N3*(M2-M4)/M3+N4-N2' →NUM 'S2' STO
PURILE >>

PURILE:

<< 'S2/S1' →NUM 'PX' STO
'(PX*M1+M2-M4)/M3' →NUM 'PY' STO
REZULTATE >>

REZULTATE:   (display the results)

<< CLLCD 1 59 
FOR I 
"Coordonate punct de
intersectie ale dia
gonalelor: P(x,y)"
1 I SUB 1 DISP NEXT 4 FIX
"P(" PX + →STR ";" +
→STR PY + →STR ")" 
+ →STR 5 DISP 0 WAIT 
STERG >>

STERG:  (cleanup, purge working variables)

<< { AX AY BX BY CX 
CY DX DY PX PY M1
M2 M3 M4 N1 N2 N3
N4 S1 S2 } PURGE
CLLCD CLEAR >>

Instructions:

Set your calculator the folder PATRULATERDIAGONALE.  Run STARTDIAGONALE and enter the coordinates.  The rest of the program runs automatically.  Start with the left hand corner and go clockwise. 

Note:  I typed Horatiu's program on an HP 49G.    In REZULTATE, for some reason I couldn't get the FIX 4 to take effect, even when I switched the calculator to Approximate mode.  So in order to get both PX and PY on the screen, I added a carriage return character (↲, [right shift] [ 2 ]) after the semicolon.  This creates a new line allowing both coordinates to be displayed.

Example:

Example 1:   (Horatiu's example)
A:  (ax, ay):  (2, 10)
B:  (bx, by):  (11, 12)
C:  (cx, cy):  (13, 6)
D:  (dx, dy):  (1, 4)

P: (px, py):  (6.46875, 8.375)
FIX 4:  (6.4688, 8.3750)

Example 2:  (my own example)
A:  (ax, ay):  (0, 8)
B:  (bx, by):  (5, 12)
C:  (cx, cy):  (7, 7)
D:  (dx, dy):  (2, 1)

P:  (px, py): (3.72649999999, 7.4625)
FIX 4:  (3.7265, 7.4625)

Source:

Horatiu, Stefanescu "Calculul Coordonatelor Punctului de Intersectie A Diagonalelor Unui Partulater Oarecare"  2018. 

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.

Sunday, August 13, 2017

Casio fx-3650p and HP 21S: The Intersection Point of a Quadrilateral

Casio fx-3650p and HP 21S: The Intersection Point of a Quadrilateral

Introduction

This program calculates the coordinates of the center of quadrilateral.  For the derivation, please see this link:  http://edspi31415.blogspot.com/2017/08/geometry-intersection-point-of.html


Casio fx-3650P

See the diagram below. 



Due to the lack of variable available, 7, the program asks for A, B, C, and D twice.  Most of my programs asks for the inputs, then executes calculations.  This program asks for some inputs, does some calculations, then asks for more input, then executes calculations, including replacing variables to make room for further calculations. 

Program (91 steps):

? → A : ? → B : ? → C : ? → D :
(D – B) ÷ (C – A → X :
B – A X → Y :
? → A : ? → B : ? → C : ? → D :
(D – B) ÷ (C – A → C :
B – A C → D :
(D – Y) ÷ (X – C → X ◢
D + C X → Y

HP 21S

See the diagram below.  Input the following points into R0 through R7.



Program (the code and steps should be the same for the HP 20S):

Step
Code
Key
01
61, 41, A
LBL A
02
33
(
03
22, 3
RCL 3
04
65
-
05
22, 1
RCL 1
06
34
)
07
45
÷
08
33
(
09
22, 2
RCL 2
10
65
-
11
22, 0
RCL 0
12
74
=
13
21, 8
RCL 8
14
55
*
15
22, 0
RCL 0
16
32
+/-
17
75
+
18
22, 1
RCL 1
19
74
=
20
21, 0
STO 9
21
33
(
22
22, 7
RCL 7
23
65
-
24
22, 5
RCL 5
25
34
)
26
45
÷
27
33
(
28
22, 6
RCL 6
29
65
-
30
22, 4
RCL 4
31
34
)
32
74
=
33
21, 6
STO 6
34
55
*
35
22, 4
RCL 4
36
32
+/-
37
75
+
38
22, 5
RCL 5
39
74
=
40
21, 7
STO 7
41
33
(
42
22, 7
RCL 7
43
65
-
44
22, 9
RCL 9
45
34
)
46
45
÷
47
33
(
48
22, 8
RCL 8
49
65
-
50
22, 6
RCL 6
51
74
=
52
21, 8
STO 8
53
26
R/S
54
55
*
55
22, 6
RCL 6
56
75
+
57
22, 7
RCL 7
58
74
=
59
21, 9
STO 9
60
61, 26
RTN


Variables – HP 21S: 

Register
Input
Output
R0
A1

R1
B1

R2
C1

R3
D1

R4
A2

R5
B2

R6
C2
C’
R7
D2
D’
R8

X
R9

Y

Example



From top-left hand corner clockwise:  (-1, 4), (4, 6), (5, -1), (0, 0)

Results:
X = 1.357142857
Y = 2.035714286

Eddie


This blog is property of Edward Shore, 2017.

Symmetric Quartic Equation - Python

Symmetric Quartic Equation - Python Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopt...