HTBasic Help
×
Menu
Index

ARG Example

   ! The ARG function returns the ANGLE of a complex number.
20    ! This program computes the angle and compares it with the result of ARG.
30    DEG
40    CLEAR SCREEN
50    COMPLEX A
60    A=CMPLX(3,4)
70    Mag=ABS(A)
80    Angle=ARG(A)
90    X=Mag*COS(Angle)
100   Y=Mag*SIN(Angle)
110   PRINT "Complex number a + bi: ";A
120   PRINT "Magnitude: ";Mag,"Angle: ";Angle
130   PRINT "Your complex number was: ";X;"+";Y;"i"
140   END