Previous Up Next

10.2.19  Rewriting sin, cos, tan in terms of half tangent

The halftan command rewrites the trigonometric functions in terms of tan(x/2) using the identities:

  sin(x) =
2tan ⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
+1
,   cos(x) =
1−tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
+1
,   tan(x) =
2tan⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
1−tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
.

Examples

halftan(sin(2*x)/(1+cos(2*x)))
     
2tan⎛
⎜
⎜
⎝
2
2
 x⎞
⎟
⎟
⎠
⎛
⎜
⎜
⎝
tan2⎛
⎜
⎜
⎝
2
2
x⎞
⎟
⎟
⎠
+1⎞
⎟
⎟
⎠
⎛
⎜
⎜
⎜
⎜
⎜
⎝
1+
1−tan2⎛
⎜
⎜
⎝
2
2
x⎞
⎟
⎟
⎠
tan2⎛
⎜
⎜
⎝
2
2
x⎞
⎟
⎟
⎠
+1
⎞
⎟
⎟
⎟
⎟
⎟
⎠
          
normal(ans())
     
tanx           
halftan(sin(x)^2+cos(x)^2)
     
⎛
⎜
⎜
⎜
⎜
⎜
⎝
2 tan⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
+1
⎞
⎟
⎟
⎟
⎟
⎟
⎠
2






 
+ ⎛
⎜
⎜
⎜
⎜
⎜
⎝
1−tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
tan2⎛
⎜
⎜
⎝
x
2
⎞
⎟
⎟
⎠
+1
⎞
⎟
⎟
⎟
⎟
⎟
⎠
2






 
          
normal(ans())
     
1           

Previous Up Next