Saturday, December 3, 2016

TI-84 Plus: Intersection of two lines – program by Jack Kesler

TI-84 Plus:  Intersection of two lines – program by Jack Kesler

Special thanks to Jack Kessler for providing the program CPXINT.  CPXINT uses complex numbers to determine:

* The equation of a line between two points.  CPXINT uses two lines:

            y = Ax + B for coordinates N1, E1 and N2, E2.
            y = Cx + D for coordinates N3, E3 and N4, E4

* The intersection of the two lines, labeled by point N5, E5.

Keep in mind N is for North (y axis) and E is for East (x axis).




TI-84 Plus Program CPXINT – Jack Kesler

Note:  Initialize all the variables by choosing option 1, SETUP.  Choose 2 for input, 3 for equations of the lines, and 4 for intersection.

ClrHome
Disp "LINE INT"
Disp "USNG CPX"
Disp "VER. 1.0"
Pause
ClrHome
Lbl 50
Menu("CPXINT","SETUP",89,"INP PTS",90,"COMP LINS",91,"COMP INT",92,"EXIT",93)
End
Lbl 89
ClrHome
ClrAllLists
11→dim(L)
{2,2}→dim([A])
{2,1}→dim([B])
Goto 50
Lbl 90
ClrHome
Disp "INP CRDS:"
Input "N1= ",T
T→L(1)
Input "E1= ",T
T→L(2)
Input "N2= ",T
T→L(3)
Input "E2= ",T
T→L(4)
Input "N3= ",T
T→L(5)
Input "E3= ",T
T→L(6)
Input "N4= ",T
T→L(7)
Input "E4= ",T
T→L(8)
ClrHome
Goto 50
Lbl 91
ClrHome
a+bi
L(2)+L(1)i→I
L(4)+L(3)i→J
angle(J-I)→θ
If θ=90 or θ=­90
Then
real(I)→B
0→[A](1,1)
1→[A](1,2)
B→[B](1,1)
0→A
Else
tan(θ)→A
imag(I)-A*real(I)→B
1→[A](1,1)
­A→[A](1,2)
B→[B](1,1)
End
Disp "Y=A*X+B"
Disp "A= ",A
Disp "B= ",B
Pause
ClrHome
L(6)+L(5)i→I
L(8)+L(7)i→J
angle(J-I)→θ
If θ=90 or θ=­90
Then
real(I)→D
0→[A](2,1)
1→[A](2,2)
D→[B](2,1)
0→C
Else
tan(θ)→C
imag(I)-C*real(I)→D
1→[A](2,1)
­C→[A](2,2)
D→[B](2,1)
End
Disp "Y=C*X+D"
Disp "C= ",C
Disp "D= ",D
Pause
ClrHome
Real
Goto 50
Lbl 92
ClrHome
If A=C
Then
Disp "PARLLEL LINES"
Disp "NO SOLUTION"
Pause
ClrHome
Goto 50
End
[A]^-1*[B]→[D]
Disp "N5= ",[D](1,1)
[D](1,1)→L(9)
Disp "E5= ",[D](2,1)
[D](2,1)→L(10)
Pause
ClrHome
Goto 50
Lbl 93
ClrHome
Stop

Example:

Line 1:  N1 = 0, E1 = 1, N2 = 7, E2 = 2. 
Line 2:  N3 = 4, E3 = 3,  N4 = 4, E3 = -3

Results:
Y = AX + B:  A = 0,  B =  4
Y = CX + D:  C = 7,  D = -7
Intersection:  N5 = 4,  E5 = 1.571428571


Thank you Jack! 

Eddie


This blog is property of Edward Shore, 2016