# Expanding transcendental and trigonometric expressions: texpand tExpand

### 5.25.1 Expanding transcendental and trigonometric expressions: texpand tExpand

The texpand command expands exponential and trigonometric functions, like simultaneous calling:
expexpand (see Section 5.24.2), which, for example, expands exp(nx) as exp(x)n,
lnexpand (see Section 5.24.3), which, for example, expands ln(xn) as nln(x) , and
trigexpand (see Section 5.23.1), which, for example, expands sin(2x) as 2sin(x)cos(x).
tExpand is a synonym for texpand.

- texpand takes one argument:
  expr, an expression containing transcendental or trigonometric functions.
- texpand(expr) expands these functions.

#### Examples.

- Expand cos(x+y).
  Input:
  texpand(cos(x+y))
  Output:

  cosx· cosy−sinx· siny

- Expand cos(3x).
  Input:
  texpand(cos(3*x))
  Output:

  4 cos3x−3 cosx

- Expand sin(3*x)+sin(7*x)/sin(5*x).
  Input:
  texpand((sin(3*x)+sin(7*x))/sin(5*x))
  Output:

  −

  2 sinx

  ⎛ ⎝ | 16 cos4x−12 cos2x+1 | ⎞ ⎠ | sinx

  +

  28 sinx· cos2x

  ⎛ ⎝ | 16 cos4x−12 cos2x+1 | ⎞ ⎠ | sinx

  −

  80 sinx· cos4x

  ⎛ ⎝ | 16 cos4x− 12 cos2x+1 | ⎞ ⎠ | sinx

  +

  64 sinx· cos6x

  ⎛ ⎝ | 16 cos4x−12 cos2x+1 | ⎞ ⎠ | sinx

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

  4 cos2x−2

- Expand exp(x+y).
  Input:
  texpand(exp(x+y))
  Output:

  ex ey

- Expand ln(x× y).
  Input:
  texpand(log(x*y))
  Output:

  lny+lnx

- Expand ln(xn).
  Input:
  texpand(ln(x^n))
  Output:

  n lnx

- Expand ln((e2)+exp(2*ln(2))+exp(ln(3)+ln(2))).
  Input:
  texpand(log(e^2)+exp(2*log(2))+exp(log(3)+log(2)))
  Output:

  6+2· 3

  or input:
  texpand(log(e^2)+exp(2*log(2)))+ lncollect(exp(log(3)+log(2)))
  Output:

  12

- Expand exp(x+y)+cos(x+y)+ln(3x2).
  Input:
  texpand(exp(x+y)+cos(x+y)+ln(3*x^2))
  Output:

  cosx· cosy−sinx· siny+ex ey+ln | ⎛ ⎝ | 3 | ⎞ ⎠ | +2 ln | ⎪ ⎪ | x | ⎪ ⎪