Go to the first, previous, next, last section, table of contents.
Maxima has many trigonometric functions defined. Not all trigonometric
identities are programmed, but it is possible for the user to add many
of them using the pattern matching capabilities of the system. The
trigonometric functions defined in Maxima are: acos,
acosh, acot, acoth, acsc,
acsch, asec, asech, asin,
asinh, atan, atanh, cos,
cosh, cot, coth, csc, csch,
sec, sech, sin, sinh, tan,
and tanh. There are a number of commands especially for
handling trigonometric functions, see trigexpand,
trigreduce, and the switch trigsign. Two share
packages extend the simplification rules built into Maxima,
ntrig and atrig1. Do describe(command)
for details.
atan(y/x) in the interval -%pi to
%pi.
atrig1 package contains several additional simplification rules
for inverse trigonometric functions. Together with rules
already known to Maxima, the following angles are fully implemented:
0, %pi/6, %pi/4, %pi/3, and %pi/2.
Corresponding angles in the other three quadrants are also available.
Do load(atrig1); to use them.
false
When halfangles is true,
half-angles are simplified away.
ntrig package contains a set of simplification rules that are
used to simplify trigonometric function whose arguments are of the form
f(n %pi/10) where f is any of the functions
sin, cos, tan, csc, sec and cot.
trigexpand: true.
trigexpand is governed by the following global flags:
trigexpand
true causes expansion of all
expressions containing sin's and cos's occurring subsequently.
halfangles
true causes half-angles to be simplified
away.
trigexpandplus
trigexpand,
expansion of sums (e.g. sin(x + y)) will take place only if
trigexpandplus is true.
trigexpandtimes
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)
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.
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.
all
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.
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
The trigonometric simplification routines will use declared information in some simple cases. Declarations about variables are used as follows, e.g.
(%i1) declare(j, integer, e, even, o, odd)$ (%i2) sin(x + (e + 1/2)*%pi); (%o2) cos(x) (%i3) sin(x + (o + 1/2)*%pi); (%o3) - cos(x)
true
When trigsign is true, it permits simplification of negative
arguments to trigonometric functions. E.g., sin(-x) will become
-sin(x) only if trigsign is true.
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.
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;
%pi
(%o1) - b - a + ---
3
(%i2) bc: sin(a)*sin(3*c)/sin(a+b);
sin(a) sin(3 b + 3 a)
(%o2) ---------------------
sin(b + a)
(%i3) ba: bc, c=a, a=c$
(%i4) ac2: ba^2 + bc^2 - 2*bc*ba*cos(b);
2 2
sin (a) sin (3 b + 3 a)
(%o4) -----------------------
2
sin (b + a)
%pi
2 sin(a) sin(3 a) cos(b) sin(b + a - ---) sin(3 b + 3 a)
3
- --------------------------------------------------------
%pi
sin(a - ---) sin(b + a)
3
2 2 %pi
sin (3 a) sin (b + a - ---)
3
+ ---------------------------
2 %pi
sin (a - ---)
3
(%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
Go to the first, previous, next, last section, table of contents.