"Testing rationalize"

clear

-- test rationalize function (this used to get stuck)

s = 4 E^2
t = -2 E^2 + E^2 exp(i theta) + E^2 exp(-i theta)
u = -2 E^2 - E^2 exp(i theta) - E^2 exp(-i theta)

A = (s^2 + u^2)/t^2
B = 2 s^2/(t u)
C = (s^2 + t^2)/u^2

X = (1 + expcos(theta/2)^4) / expsin(theta/2)^4
Y = 8 / expsin(theta)^2
Z = (1 + expsin(theta/2)^4) / expcos(theta/2)^4

check(rationalize(A + B + C - X - Y - Z) == 0)

f = 1/x + 1/(x + 1)^2
check(infixform(rationalize(f)) == "(x^2 + 3 x + 1) / (x (x + 1)^2)")
