### 5.22.17 Rewrite sin, cos, tan in terms of tan(x/2) : halftan

halftan takes as argument an expression containing trigonometric functions.
halftan rewrites sin(x), cos(x) and tan(x) in terms of tan(x/2).
Input :

halftan(sin(2*x)/(1+cos(2*x)))

Output :

2*tan(2*x/2)/((tan(2*x/2))`^`2+1)/
(1+(1-(tan(2*x/2))`^`2)/((tan(2*x/2))`^`2+1))

Output, after simplification with normal(ans()) :

tan(x)

Input :

halftan(sin(x)`^`2+cos(x)`^`2)

Output :

(2*tan(x/2)/((tan(x/2))`^`2+1))`^`2+
((1-(tan(x/2))`^`2)/((tan(x/2))`^`2+1))`^`2

Output, after simplification with normal(ans()) :

1