Saturday, September 18, 2021

Sharp EL-5500III & PC-1403: Complex Number Arithmetic and Vectors

 Sharp EL-5500III & PC-1403:  Complex Number Arithmetic and Vectors


Complex Number Arithmetic

This program calculates the four arithmetic functions for complex numbers in the form of x + i*y, where i = √-1.

Sharp EL-5500III/PC-1403 Program:  Complex Number Arithmetic
RUN 600 (or whatever line you designate)

600 PRINT "COMPLEX ARITHMETIC"
603 INPUT "A? "; A, "Bi? "; B, "C? "; C, "Di? "; D
606 INPUT "1:+ 2:- 3:* 4:/ :"; H
609 IF H=1 THEN 630
612 IF H=2 THEN 640
615 IF H=3 THEN 650
618 IF H=4 THEN 660
621 GOTO 606
630 PRINT A+C; "+ "; B+D; "i": END
640 PRINT A-C; "+ "; B-D; "i": END
650 PRINT A*C-B*D; "+ "; B*C+A*D; "i": END
660 W=(C^2+D^2)
663 PRINT (A*C+B*D)/W; "+ "; (B*C-A*D)/W; "i": END

Example

a + bi = 8 + 3i;  c + di = -4 + 2i
Add: 4 + 5i
Subtract: 12 + 1i
Multiply: -38 + 4i
Divide:  -1.3 + -1.4i

Vectors

This program calculates the dot product, cross product, and the angle between of two vectors.   

Sharp EL-5500III/PC-1403 Program:  Vectors
RUN 800 (or whatever line you designate)

800 PRINT "TWO VECTORS"
803 DIM A(2): DIM B(2)
806 INPUT "A0? "; A(0), "A1? "; A(1), "A2? "; A(2)
809 INPUT "B0? "; B(0), "B1? "; B(1), "B2? "; B(2)
812 INPUT "1.DOT 2.CROSS 3.ANGLE :"; H
815 IF H=1 THEN 830
818 IF H=2 THEN 840
821 IF H=3 THEN 850
824 GOTO 812
830 D=A(0)*B(0)+A(1)*B(1)+A(2)*B(2)
832 PRINT "DOT = ";D : END
840 DIM R(2): R(0)=A(1)*B(2)-A(2)*B(1)
842 R(1)=A(2)*B(0)-A(0)*B(2)
844 R(2)=A(0)*B(1)-A(1)*B(0)
846 PRINT "R0:";R(0) :PRINT "R1:";R(1) :PRINT "R2:";R(2)
848 END
850 X=√(A(0)^2+A(1)^2+A(2)^2)
852 Y=√(B(0)^2+B(1)^2+B(2)^2)
854 D=A(0)*B(0)+A(1)*B(1)+A(2)*B(2)
856 N= ACS (D/(X*Y))
858 PRINT "ANG = "; N: END

Example (Degrees mode set)

A:  A(0) = 4, A(1) = -3, A(2) = 2
B:  B(0) = 6, B(1) = 7, B(2) = -1
Dot:  1
Cross: R(0) = -11, R(1) = 16, R(2) = 46
Angle:  88.85263015°

Eddie

All original content copyright, © 2011-2021.  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. 

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...