Rewriting trigonometric functions in terms of tan(x/2) and hyperbolic functions in terms of exp(x): halftan_hyp2exp

### 5.23.20 Rewriting trigonometric functions in terms of tan(x/2) and hyperbolic functions in terms of exp(x): halftan_hyp2exp

The halftan_hyp2exp command rewrites the trigonometric function in terms of tan(x/2) (like halftan, see Section 5.23.19) and rewrites the hyperbolic functions in terms of their definitions using exponentials, namely:

sinh(x) |
= |
ex−e−x
2
cosh(x) |
= |
ex+e−x
2
tanh(x) |
= |
ex−e−x
ex+e−x
| = |
e2x−1
e2x+1

- halftan_hyp2exp takes one argument:
  expr, a trigonometric and hyperbolic expression.
- halftan_hyp2exp(expr) returns expr with any trigonometric functions replaced by the appropriate expression in tan(x/2) and any hyperbolic functions replaced by the appropriate exponentials.

#### Examples.

- Input:
  halftan_hyp2exp(tan(x)+tanh(x))
  Output:

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

- Input:
  halftan_hyp2exp(sin(x)^2+cos(x)^2-sinh(x)^2+cosh(x)^2)
  Output (after simplification with normal(ans())):

  2