The Museum of HP Calculators

Intersection of Line and Line for the HP-33E/C

This program is Copyright © 1978 by Hewlett-Packard and is used here by permission. This program was originally published in "HP-33E Mathematics Applications".

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

This program calculates the point of intersection (xp, yp) of two lines, each of them is specified by two points i.e., (x1, y1), (x1', y1') and (x2, y2), (x2', y2'). xp and yp are calculated from the equation of straight line y = x tan + c. i.e. by solving:

```      | 1  -tan theta1 |  | yp |   | c1 |
| 1  -tan theta2 |  | xp | = | c2 |
```

"Error 0" will be displayed if two lines have the same slope, i.e. if they are either parallel or overlapping.

Instructions

 Step Instructions Input Data/Units Keys Output Data/Units 1 Enter program 2 Input the first line by two points x1 ENTER x1' ENTER y1 ENTER y1' GSB 01 C1 3 Input the 2nd line by two points and calculate the intersection. x2 ENTER x2' ENTER y2 ENTER y2' GSB 10 xp R/S yp 4 For a new pair of lines, go to step 2.

Example

Find the intersection of the lines defined by the points (4, 8), (-1, -2) and (-3, 9), (7, -1).

Solution:

```xp = 4, yp = 2

Keystrokes        Display
4 ENTER 1
CHS ENTER 8
ENTER 2 CHS
GSB 01            0.0000
3 CHS ENTER 7
ENTER 9 ENTER 1
CHS GSB 10        4.0000
R/S               2.0000
```

The Program

```LINE    CODE    KEYS
00             f CLEAR PRGM
01     12 37   GSB 37
02     23  3   STO 3
03     24  2   RCL 2
04     24  1   RCL 1
05     24  3   RCL 3
06        61   x
07        41   -
08     23  4   STO 4
09        74   R/S
10     12 37   GSB 37
11     23  5   STO 5
12     24  2   RCL 2
13     24  1   RCL 1
14     24  5   RCL 5
15        61   x
16        41   -
17     23  6   STO 6
18     24  4   RCL 4
19        41   -
20     24  3   RCL 3
21     24  5   RCL 5
22        41   -
23     23  7   STO 7
24        71   ÷
25        74   R/S
26     24  4   RCL 4
27     24  5   RCL 5
28        32   CHS
29        61   x
30     24  3   RCL 3
31     24  6   RCL 6
32        61   x
33        51   +
34     24  7   RCL 7
35        71   ÷
36        74   R/S
37     23  1   STO 1
38        41   -
39     23  0   STO 0
40        22   Roll dn
41     23  2   STO 2
42        41   -
43     24  0   RCL 0
44     15  4   g ->P
45        22   Roll dn
46     14  9   f TAN
47     15 12   g RTN
```

Register Use

```R0  used
R1  x1', x2'
R2  y1', y2'
R3  tan1
R4  c1
R5  tan2
R6  C2
R7  Det
```