ay = 170: fg = 75

CLS

SCREEN 12

LOCATE 10, 1

PRINT "                              PROGRAM 'ELLIPOLA'"

PRINT

PRINT

PRINT "Plots the ellipse of polarization and the sense of rotation taking as"

PRINT "input data the amplitudes in two orthogonal axes and the phase"

PRINT "difference between them."

PRINT "Formulae taken from Born-Wolf,'Principles of Optics', Pergamon 1959,"

PRINT "pag 27, formulae 30 to 32."

PRINT "Verified coincidence with Rey Pastor-Santalo-Balanzat,"

PRINT "'Geometria Analitica', Kapelusz 1955, pag 143, formula 1 and pag 156, formula 26"

PRINT "The default values are those of Fig.1.2"

PRINT "To finish put Ay = 0"

DO: LOOP WHILE INKEY\$ = ""

pi = 4 * ATN(1)

ax = 200

dt = .01

verde = 10

rojo = 4

DO

CLS

PRINT "Amplitude in y (0<Ay<200)": PRINT

PRINT "Ay ="; ay; : INPUT a\$: IF a\$ <> "" THEN ay = VAL(a\$)

IF ay = 0 THEN END

PRINT : PRINT : PRINT

PRINT "Phase in degrees, fg": PRINT

PRINT "fg ="; fg; : INPUT a\$: IF a\$ <> "" THEN fg = VAL(a\$)

f = fg * pi / 180

alfa = ATN(ay / ax)

psi = .5 * ATN(TAN(2 * alfa) * COS(f))

psig = (180 / pi) * psi

u = SIN(2 * alfa) * SIN(f)

IF u = 1 THEN u = .99999

ji = .5 * ATN(u / SQR(1 - u ^ 2))

ea = SQR((ax ^ 2 + ay ^ 2) / (1 + TAN(ji) ^ 2))

eb = ea * TAN(ji)

cp = COS(psi)

sp = SIN(psi)

CLS

PRINT "Amplitude Ax ="; ax, "Amplitude Ay ="; ay, "Phase in degrees ="; fg

LOCATE 30, 1

PRINT "a Axis ="; ea, "b Axis ="; eb, "Angle (a,x) ="; INT(psig * 1000) / 1000;

LINE (319 - ax, 239 - ay)-(320 + ax, 239 + ay), 15, B

LINE (319 - ea * cp, 239 + ea * sp)-(319 + ea * cp, 239 - ea * sp)

LINE (319 - eb * sp, 239 - eb * cp)-(319 + eb * sp, 239 + eb * cp)

LINE (319 - ax, 239)-(319 + ax, 239), 8

LINE (319, 239 - ay)-(319, 239 + ay), 8

DO WHILE INKEY\$ = ""

FOR t = 0 TO 360 STEP dt

ex = ax * COS(pi * t / 180)

ey = ay * COS((pi / 180) * (t + fg))

PSET (320 + ex, 239 - ey), verde

NEXT t

SWAP verde, rojo

LOOP

LOOP