Author: Wolfram Koepf.
The REDUCE package TRIGSIMP is a useful tool for all kinds of problems related to trigonometric and hyperbolic simplification and factorization. There are three operators included in TRIGSIMP: trigsimp, trigfactorize and triggcd. The first is for simplifying trigonometric or hyperbolic expressions and has many options, the second is for factorizing them and the third is for finding the greatest common divisor of two trigonometric or hyperbolic polynomials. This package is automatically loaded when one of these operators is used.
As there is no normal form for trigonometric and hyperbolic expressions, the same function can convert in many different directions, e.g. sin(2x) ↔ 2 sin(x) cos(x). The user has the possibility to give several parameters to the operator trigsimp in order to influence the transformations. It is possible to decide whether or not a rational expression involving trigonometric and hyperbolic functions vanishes.
To simplify an expression f, one uses trigsimp(f[,options]). For example:
The possible options (where * denotes the default) are:
From each of the first four groups one can use at most one option, otherwise an error message will occur. Options can be given in any order.
The first group fixes the preference used while transforming a trigonometric expression:
The second group is the equivalent for the hyperbolic functions.
The third group determines the type of transformation. With the default, expand, an expression is transformed to use only simple variables as arguments:
With combine, products of trigonometric functions are transformed to trigonometric functions involving sums of variables:
With compact, the REDUCE operator compact[?] is applied to f. This often leads to a simple form, but in contrast to expand one does not get a normal form. For example:
With an option from the fourth group, the input expression is transformed to trigonometric, hyperbolic or exponential form respectively:
Usually, tan, cot, sec, csc are expressed in terms of sin and cos. It can sometimes be useful to avoid this, which is handled by the option keepalltrig:
Alternatively, the options tan and/or tanh can be given to convert the output to the specified form as far as possible:
By default, the other functions used will be cos and/or cosh, unless the other desired functions are also specified in which case this choice will be respected.
The final possibility is to specify additional target arguments for the trigonometric or hyperbolic functions, each of which should have the form of a variable divided by a positive integer. These additional arguments are treated as if they had occurred within the expression to be simplified, and their denominators are used in determining the overall denominator to use for each variable in the simplified form:
It is possible to use the options of different groups simultaneously:
Sometimes, it is necessary to handle an expression in separate steps:
The trigsimp operator can be applied to equations, lists and matrices (and compositions thereof) as well as scalar expressions, and automatically maps itself recursively over such non-scalar data structures:
With trigfactorize(p,x) one can factorize the trigonometric or hyperbolic polynomial p in terms of trigonometric functions of the argument x. The output has the same format as that from the standard REDUCE operator factorize. For example:
If the polynomial is not coordinated or balanced [?], the output will equal the input. In this case, changing the value for x can help to find a factorization, e.g.
The polynomial can consist of both trigonometric and hyperbolic functions:
The trigfactorize operator respects the standard REDUCE factorize switch nopowers – see the REDUCE manual for details. Turning it on gives the behaviour that was standard before REDUCE 3.7:
The operator triggcd is essentially an application of the algorithm behind trigfactorize. With its help the user can find the greatest common divisor of two trigonometric or hyperbolic polynomials. It uses the method described in [?]. The syntax is triggcd(p,q,x), where p and q are the trigonometric polynomials and x is the argument to use. For example:
The polynomials p and q can consist of both trigonometric and hyperbolic functions:
With the help of this package the user can create identities:
Some difficult expressions can be simplified:
Certain integrals whose evaluation was not possible in REDUCE (without preprocessing) are now computable:
Without the package, the integration fails, and in the second case one does not receive an answer for many hours.