#### 10.5.2.3 Explicit Simplifications Using Identities

Function: trigexpand (expr)

  Expands trigonometric and hyperbolic functions of sums of angles and of multiple angles occurring in expr. For best results, expr should be expanded. To enhance user control of simplification, this function expands only one level at a time, expanding sums of angles or multiple angles. To obtain full expansion into sines and cosines immediately, set the switch `trigexpand: true`.

  `trigexpand` is governed by the following global flags:

  `trigexpand`

    If `true` causes expansion of all expressions containing sin’s and cos’s occurring subsequently.

  `halfangles`

    If `true` causes half-angles to be simplified away.

  `trigexpandplus`

    Controls the "sum" rule for `trigexpand`, expansion of sums (e.g. `sin(x + y)`) will take place only if `trigexpandplus` is `true`.

  `trigexpandtimes`

    Controls the "product" rule for `trigexpand`, expansion of products (e.g. `sin(2 x)`) will take place only if `trigexpandtimes` is `true`.

  Examples:

      (%i1) x+sin(3*x)/sin(x),trigexpand=true,expand;
                               2            2
      (%o1)              (- sin (x)) + 3 cos (x) + x

      (%i2) trigexpand(sin(10*x+y));
      (%o2)          cos(10 x) sin(y) + sin(10 x) cos(y)

  Categories:Trigonometric functions ·Simplification functions ·

Option variable: trigexpandplus

  Default value: `true`

  `trigexpandplus` controls the "sum" rule for `trigexpand`. Thus, when the `trigexpand` command is used or the `trigexpand` switch set to `true`, expansion of sums (e.g. `sin(x+y))` will take place only if `trigexpandplus` is `true`.

  Categories:Trigonometric functions ·Simplification flags and variables ·

Option variable: trigexpandtimes

  Default value: `true`

  `trigexpandtimes` controls the "product" rule for `trigexpand`. Thus, when the `trigexpand` command is used or the `trigexpand` switch set to `true`, expansion of products (e.g. `sin(2*x)`) will take place only if `trigexpandtimes` is `true`.

  Categories:Trigonometric functions ·Simplification flags and variables ·

Option variable: triginverses

  Default value: `true`

  `triginverses` controls the simplification of the composition of trigonometric and hyperbolic functions with their inverse functions.

  If `all`, both e.g. `atan(tan(x))` and `tan(atan(x))` simplify to x.

  If `true`, the `arcfun(fun(x))` simplification is turned off.

  If `false`, both the `arcfun(fun(x))` and `fun(arcfun(x))` simplifications are turned off.

  Categories:Trigonometric functions ·Simplification flags and variables ·

Function: trigreduce
`trigreduce` (expr, x)
`trigreduce` (expr)

  Combines products and powers of trigonometric and hyperbolic sin’s and cos’s of x into those of multiples of x. It also tries to eliminate these functions when they occur in denominators. If x is omitted then all variables in expr are used.

  See also `poissimp`.

      (%i1) trigreduce(-sin(x)^2+3*cos(x)^2+x);
                     cos(2 x)      cos(2 x)   1        1
      (%o1)          -------- + 3 (-------- + -) + x - -
                        2             2       2        2

  Categories:Trigonometric functions ·Simplification functions ·

Function: trigsimp (expr)

  Employs the identities \(\sin\left(x\right)^2 + \cos\left(x\right)^2 = 1\) and \(\cosh\left(x\right)^2 - \sinh\left(x\right)^2 = 1\) to simplify expressions containing `tan`, `sec`, etc., to `sin`, `cos`, `sinh`, `cosh`.

  `trigreduce`, `ratsimp`, and `radcan` may be able to further simplify the result.

  `demo ("trgsmp.dem")` displays some examples of `trigsimp`.

  Categories:Trigonometric functions ·Simplification functions ·

Function: trigrat (expr)

  Gives a canonical simplified quasilinear form of a trigonometrical expression; expr is a rational fraction of several `sin`, `cos` or `tan`, the arguments of them are linear forms in some variables (or kernels) and `%pi/n` (n integer) with integer coefficients. The result is a simplified fraction with numerator and denominator linear in `sin` and `cos`. Thus `trigrat` linearize always when it is possible.

      (%i1) trigrat(sin(3*a)/sin(a+%pi/3));
      (%o1)            sqrt(3) sin(2 a) + cos(2 a) - 1

  The following example is taken from Davenport, Siret, and Tournier, Calcul Formel, Masson (or in English, Addison-Wesley), section 1.5.5, Morley theorem.

      (%i1) c : %pi/3 - a - b$

      (%i2) bc : sin(a)*sin(3*c)/sin(a+b);
                                                 %pi
                       sin(a) sin(3 ((- b) - a + ---))
                                                  3
      (%o2)            -------------------------------
                                 sin(b + a)

      (%i3) ba : bc, c=a, a=c;
                                               %pi
                          sin(3 a) sin(b + a - ---)
                                                3
      (%o3)               -------------------------
                                        %pi
                                sin(a - ---)
                                         3

      (%i4) ac2 : ba^2 + bc^2 - 2*bc*ba*cos(b);
               2         2         %pi
            sin (3 a) sin (b + a - ---)
                                    3
      (%o4) ---------------------------
                      2     %pi
                   sin (a - ---)
                             3
                                               %pi
       - (2 sin(a) sin(3 a) sin(3 ((- b) - a + ---)) cos(b)
                                                3
                   %pi            %pi
       sin(b + a - ---))/(sin(a - ---) sin(b + a))
                    3              3
            2       2                %pi
         sin (a) sin (3 ((- b) - a + ---))
                                      3
       + ---------------------------------
                       2
                    sin (b + a)

      (%i5) trigrat (ac2);
      (%o5) - (sqrt(3) sin(4 b + 4 a) - cos(4 b + 4 a)
       - 2 sqrt(3) sin(4 b + 2 a) + 2 cos(4 b + 2 a)
       - 2 sqrt(3) sin(2 b + 4 a) + 2 cos(2 b + 4 a)
       + 4 sqrt(3) sin(2 b + 2 a) - 8 cos(2 b + 2 a) - 4 cos(2 b - 2 a)
       + sqrt(3) sin(4 b) - cos(4 b) - 2 sqrt(3) sin(2 b) + 10 cos(2 b)
       + sqrt(3) sin(4 a) - cos(4 a) - 2 sqrt(3) sin(2 a) + 10 cos(2 a)
       - 9)/4

  Categories:Trigonometric functions ·Simplification functions ·