6
7
@node Introduction to Trigonometric, Definitions for Trigonometric, Trigonometric, Trigonometric
7
8
@section Introduction to Trigonometric
8
- MACSYMA has many Trig functions defined. Not all Trig
10
Maxima has many trigonometric functions defined. Not all trigonometric
9
11
identities are programmed, but it is possible for the user to add many
10
12
of them using the pattern matching capabilities of the system. The
11
Trig functions defined in MACSYMA are: ACOS, ACOSH, ACOT, ACOTH, ACSC,
12
ACSCH, ASEC, ASECH, ASIN, ASINH, ATAN, ATANH, COS, COSH, COT, COTH,
13
CSC, CSCH, SEC, SECH, SIN, SINH, TAN, and TANH. There are a number of
14
commands especially for handling Trig functions, see TRIGEXPAND,
15
TRIGREDUCE, and the switch TRIGSIGN. Two SHARE packages extend the
16
simplification rules built into MACSYMA, NTRIG and ATRIG1. Do
17
DESCRIBE(cmd) for details.
13
trigonometric functions defined in Maxima are: @code{acos},
14
@code{acosh}, @code{acot}, @code{acoth}, @code{acsc},
15
@code{acsch}, @code{asec}, @code{asech}, @code{asin},
16
@code{asinh}, @code{atan}, @code{atanh}, @code{cos},
17
@code{cosh}, @code{cot}, @code{coth}, @code{csc}, @code{csch},
18
@code{sec}, @code{sech}, @code{sin}, @code{sinh}, @code{tan},
19
and @code{tanh}. There are a number of commands especially for
20
handling trigonometric functions, see @code{trigexpand},
21
@code{trigreduce}, and the switch @code{trigsign}. Two share
22
packages extend the simplification rules built into Maxima,
23
@code{ntrig} and @code{atrig1}. Do @code{describe(@var{command})}
19
@c end concepts Trigonometric
20
26
@node Definitions for Trigonometric, , Introduction to Trigonometric, Trigonometric
21
27
@section Definitions for Trigonometric
22
@c end concepts Trigonometric
29
@c @unnumberedsec phony
31
- Hyperbolic Arc Cosine
35
@c @unnumberedsec phony
41
@c @unnumberedsec phony
43
- Hyperbolic Arc Cotangent
47
@c @unnumberedsec phony
53
@c @unnumberedsec phony
55
- Hyperbolic Arc Cosecant
59
@c @unnumberedsec phony
65
@c @unnumberedsec phony
67
- Hyperbolic Arc Secant
71
@c @unnumberedsec phony
77
@c @unnumberedsec phony
83
@c @unnumberedsec phony
89
@c @unnumberedsec phony
91
yields the value of ATAN(Y/X) in the interval -%PI to
96
@c @unnumberedsec phony
98
- Hyperbolic Arc Tangent
102
@c @unnumberedsec phony
104
- SHARE1;ATRIG1 FASL contains several additional
105
simplification rules for inverse trig functions. Together with rules
106
already known to Macsyma, the following angles are fully implemented:
107
0, %PI/6, %PI/4, %PI/3, and %PI/2. Corresponding angles in the other
108
three quadrants are also available. Do LOAD(ATRIG1); to use them.
112
@c @unnumberedsec phony
118
@c @unnumberedsec phony
124
@c @unnumberedsec phony
130
@c @unnumberedsec phony
132
- Hyperbolic Cotangent
136
@c @unnumberedsec phony
142
@c @unnumberedsec phony
144
- Hyperbolic Cosecant
148
@c @unnumberedsec phony
150
default: [FALSE] - if TRUE causes half-angles to be
155
@c @unnumberedsec phony
161
@c @unnumberedsec phony
167
@c @unnumberedsec phony
173
@c @unnumberedsec phony
179
@c @unnumberedsec phony
185
@c @unnumberedsec phony
191
@c @unnumberedsec phony
192
@defun TRIGEXPAND (exp)
193
expands trigonometric and hyperbolic functions of
194
sums of angles and of multiple angles occurring in exp. For best
195
results, exp should be expanded. To enhance user control of
29
@deffn {Function} acos (@var{x})
34
@deffn {Function} acosh (@var{x})
35
- Hyperbolic Arc Cosine.
39
@deffn {Function} acot (@var{x})
44
@deffn {Function} acoth (@var{x})
45
- Hyperbolic Arc Cotangent.
49
@deffn {Function} acsc (@var{x})
54
@deffn {Function} acsch (@var{x})
55
- Hyperbolic Arc Cosecant.
59
@deffn {Function} asec (@var{x})
64
@deffn {Function} asech (@var{x})
65
- Hyperbolic Arc Secant.
69
@deffn {Function} asin (@var{x})
74
@deffn {Function} asinh (@var{x})
75
- Hyperbolic Arc Sine.
79
@deffn {Function} atan (@var{x})
84
@deffn {Function} atan2 (@var{y}, @var{x})
85
- yields the value of @code{atan(@var{y}/@var{x})} in the interval @code{-%pi} to
90
@deffn {Function} atanh (@var{x})
91
- Hyperbolic Arc Tangent.
95
@c IS THIS DESCRIPTION ACCURATE ??
96
@c LET'S BE EXPLICIT ABOUT EXACTLY WHAT ARE THE RULES IMPLEMENTED BY THIS PACKAGE
97
@defvr {Package} atrig1
98
The @code{atrig1} package contains several additional simplification rules
99
for inverse trigonometric functions. Together with rules
100
already known to Maxima, the following angles are fully implemented:
101
@code{0}, @code{%pi/6}, @code{%pi/4}, @code{%pi/3}, and @code{%pi/2}.
102
Corresponding angles in the other three quadrants are also available.
103
Do @code{load(atrig1);} to use them.
107
@deffn {Function} cos (@var{x})
112
@deffn {Function} cosh (@var{x})
117
@deffn {Function} cot (@var{x})
122
@deffn {Function} coth (@var{x})
123
- Hyperbolic Cotangent.
127
@deffn {Function} csc (@var{x})
132
@deffn {Function} csch (@var{x})
133
- Hyperbolic Cosecant.
137
@defvr {Option variable} halfangles
138
Default value: @code{false}
140
When @code{halfangles} is @code{true},
141
half-angles are simplified away.
142
@c WHAT DOES THIS STATEMENT MEAN EXACTLY ??
147
@c IS THIS DESCRIPTION ACCURATE ??
148
@c LET'S BE EXPLICIT ABOUT EXACTLY WHAT ARE THE RULES IMPLEMENTED BY THIS PACKAGE
149
@defvr {Package} ntrig
150
The @code{ntrig} package contains a set of simplification rules that are
151
used to simplify trigonometric function whose arguments are of the form
152
@code{@var{f}(@var{n} %pi/10)} where @var{f} is any of the functions
153
@code{sin}, @code{cos}, @code{tan}, @code{csc}, @code{sec} and @code{cot}.
154
@c NEED TO LOAD THIS PACKAGE ??
158
@deffn {Function} sec (@var{x})
163
@deffn {Function} sech (@var{x})
168
@deffn {Function} sin (@var{x})
173
@deffn {Function} sinh (@var{x})
178
@deffn {Function} tan (@var{x})
183
@deffn {Function} tanh (@var{x})
184
- Hyperbolic Tangent.
188
@c NEEDS CLARIFICATION AND EXAMPLES
189
@deffn {Function} trigexpand (@var{expr})
190
Expands trigonometric and hyperbolic functions of
191
sums of angles and of multiple angles occurring in @var{expr}. For best
192
results, @var{expr} should be expanded. To enhance user control of
196
193
simplification, this function expands only one level at a time,
197
194
expanding sums of angles or multiple angles. To obtain full expansion
198
into sines and cosines immediately, set the switch TRIGEXPAND:TRUE.
199
TRIGEXPAND default: [FALSE] - if TRUE causes expansion of all
200
expressions containing SINs and COSs occurring subsequently.
201
HALFANGLES[FALSE] - if TRUE causes half-angles to be simplified away.
202
TRIGEXPANDPLUS[TRUE] - controls the "sum" rule for TRIGEXPAND,
203
expansion of sums (e.g. SIN(X+Y)) will take place only if
204
TRIGEXPANDPLUS is TRUE.
205
TRIGEXPANDTIMES[TRUE] - controls the "product" rule for TRIGEXPAND,
206
expansion of products (e.g. SIN(2*X)) will take place only if
207
TRIGEXPANDTIMES is TRUE.
195
into sines and cosines immediately, set the switch @code{trigexpand: true}.
197
@code{trigexpand} is governed by the following global flags:
201
If @code{true} causes expansion of all
202
expressions containing sin's and cos's occurring subsequently.
204
If @code{true} causes half-angles to be simplified
207
Controls the "sum" rule for @code{trigexpand},
208
expansion of sums (e.g. @code{sin(x + y)}) will take place only if
209
@code{trigexpandplus} is @code{true}.
210
@item trigexpandtimes
211
Controls the "product" rule for @code{trigexpand},
212
expansion of products (e.g. @code{sin(2 x)}) will take place only if
213
@code{trigexpandtimes} is @code{true}.
219
@c x+sin(3*x)/sin(x),trigexpand=true,expand;
220
@c trigexpand(sin(10*x+y));
209
(%i1) X+SIN(3*X)/SIN(X),TRIGEXPAND=TRUE,EXPAND;
211
(%o1) - SIN (X) + 3 COS (X) + X
212
(%i2) TRIGEXPAND(SIN(10*X+Y));
213
(%o2) COS(10 X) SIN(Y) + SIN(10 X) COS(Y)
223
(%i1) x+sin(3*x)/sin(x),trigexpand=true,expand;
225
(%o1) - sin (x) + 3 cos (x) + x
226
(%i2) trigexpand(sin(10*x+y));
227
(%o2) cos(10 x) sin(y) + sin(10 x) cos(y)
218
@c @node TRIGEXPANDPLUS
219
@c @unnumberedsec phony
220
@defvar TRIGEXPANDPLUS
221
default: [TRUE] - controls the "sum" rule for
222
TRIGEXPAND. Thus, when the TRIGEXPAND command is used or the
223
TRIGEXPAND switch set to TRUE, expansion of sums (e.g. SIN(X+Y)) will
224
take place only if TRIGEXPANDPLUS is TRUE.
227
@c @node TRIGEXPANDTIMES
228
@c @unnumberedsec phony
229
@defvar TRIGEXPANDTIMES
230
default: [TRUE] - controls the "product" rule for
231
TRIGEXPAND. Thus, when the TRIGEXPAND command is used or the
232
TRIGEXPAND switch set to TRUE, expansion of products (e.g. SIN(2*X))
233
will take place only if TRIGEXPANDTIMES is TRUE.
236
@c @node TRIGINVERSES
237
@c @unnumberedsec phony
239
default: [ALL] - controls the simplification of the
240
composition of trig and hyperbolic functions with their inverse
241
functions: If ALL, both e.g. ATAN(TAN(X)) and TAN(ATAN(X)) simplify to
242
X. If TRUE, the arcfunction(function(x)) simplification is turned
243
off. If FALSE, both the arcfun(fun(x)) and fun(arcfun(x))
233
@defvr {Option variable} trigexpandplus
234
Default value: @code{true}
236
@code{trigexpandplus} controls the "sum" rule for
237
@code{trigexpand}. Thus, when the @code{trigexpand} command is used or the
238
@code{trigexpand} switch set to @code{true}, expansion of sums
239
(e.g. @code{sin(x+y))} will take place only if @code{trigexpandplus} is
244
@defvr {Option variable} trigexpandtimes
245
Default value: @code{true}
247
@code{trigexpandtimes} controls the "product" rule for
248
@code{trigexpand}. Thus, when the @code{trigexpand} command is used or the
249
@code{trigexpand} switch set to @code{true}, expansion of products (e.g. @code{sin(2*x)})
250
will take place only if @code{trigexpandtimes} is @code{true}.
254
@defvr {Option variable} triginverses
255
Default value: @code{all}
257
@code{triginverses} controls the simplification of the
258
composition of trigonometric and hyperbolic functions with their inverse
261
If @code{all}, both e.g. @code{atan(tan(@var{x}))}
262
and @code{tan(atan(@var{x}))} simplify to @var{x}.
264
If @code{true}, the @code{@var{arcfun}(@var{fun}(@var{x}))}
265
simplification is turned off.
267
If @code{false}, both the
268
@code{@var{arcfun}(@var{fun}(@var{x}))} and
269
@code{@var{fun}(@var{arcfun}(@var{x}))}
244
270
simplifications are turned off.
248
@c @unnumberedsec phony
249
@defun TRIGREDUCE (exp, var)
250
combines products and powers of trigonometric
251
and hyperbolic SINs and COSs of var into those of multiples of var.
274
@deffn {Function} trigreduce (@var{expr}, @var{x})
275
@deffnx {Function} trigreduce (@var{expr})
276
Combines products and powers of trigonometric
277
and hyperbolic sin's and cos's of @var{x} into those of multiples of @var{x}.
252
278
It also tries to eliminate these functions when they occur in
253
denominators. If var is omitted then all variables in exp are used.
254
Also see the POISSIMP function (6.6).
279
denominators. If @var{x} is omitted then all variables in @var{expr} are used.
281
See also @code{poissimp}.
284
@c trigreduce(-sin(x)^2+3*cos(x)^2+x);
256
(%i4) TRIGREDUCE(-SIN(X)^2+3*COS(X)^2+X);
257
(%o4) 2 COS(2 X) + X + 1
287
(%i1) trigreduce(-sin(x)^2+3*cos(x)^2+x);
288
cos(2 x) cos(2 x) 1 1
289
(%o1) -------- + 3 (-------- + -) + x - -
258
294
The trigonometric simplification routines will use declared
259
295
information in some simple cases. Declarations about variables are
260
296
used as follows, e.g.
261
(%i5) DECLARE(J, INTEGER, E, EVEN, O, ODD)$
262
(%i6) SIN(X + (E + 1/2)*%PI)$
264
(%i7) SIN(X + (O + 1/2) %PI);
299
@c declare(j, integer, e, even, o, odd)$
300
@c sin(x + (e + 1/2)*%pi);
301
@c sin(x + (o + 1/2)*%pi);
304
(%i1) declare(j, integer, e, even, o, odd)$
305
(%i2) sin(x + (e + 1/2)*%pi);
307
(%i3) sin(x + (o + 1/2)*%pi);
271
@c @unnumberedsec phony
273
default: [TRUE] - if TRUE permits simplification of negative
274
arguments to trigonometric functions. E.g., SIN(-X) will become
275
-SIN(X) only if TRIGSIGN is TRUE.
279
@c @unnumberedsec phony
280
@defun TRIGSIMP (expr)
281
employs the identities sin(x)^2 + cos(x)^2 = 1 and
282
cosh(x)^2 - sinh(x)^2 = 1 to simplify expressions containing tan, sec,
283
etc. to sin, cos, sinh, cosh so that further simplification may be
284
obtained by using TRIGREDUCE on the result. Some examples may be seen
285
by doing DEMO("trgsmp.dem"); . See also the TRIGSUM function.
289
@c @unnumberedsec phony
290
@defun TRIGRAT (trigexp)
291
gives a canonical simplifyed quasilinear form of a
292
trigonometrical expression; trigexp is a rational fraction of several sin,
293
cos or tan, the arguments of them are linear forms in some variables (or
294
kernels) and %pi/n (n integer) with integer coefficients. The result is a
295
simplifyed fraction with numerator and denominator linear in sin and cos.
296
Thus TRIGRAT linearize always when it is possible.(written by D. Lazard).
314
@defvr {Option variable} trigsign
315
Default value: @code{true}
317
When @code{trigsign} is @code{true}, it permits simplification of negative
318
arguments to trigonometric functions. E.g., @code{sin(-x)} will become
319
@code{-sin(x)} only if @code{trigsign} is @code{true}.
323
@deffn {Function} trigsimp (@var{expr})
324
Employs the identities @math{sin(x)^2 + cos(x)^2 = 1} and
325
@math{cosh(x)^2 - sinh(x)^2 = 1} to simplify expressions containing @code{tan}, @code{sec},
326
etc., to @code{sin}, @code{cos}, @code{sinh}, @code{cosh}.
328
@code{trigreduce}, @code{ratsimp}, and @code{radcan} may be
329
able to further simplify the result.
331
@code{demo ("trgsmp.dem")} displays some examples of @code{trigsimp}.
332
@c MERGE EXAMPLES INTO THIS ITEM
336
@c NEEDS CLARIFICATION
337
@deffn {Function} trigrat (@var{expr})
338
Gives a canonical simplifyed quasilinear form of a
339
trigonometrical expression; @var{expr} is a rational fraction of several @code{sin},
340
@code{cos} or @code{tan}, the arguments of them are linear forms in some variables (or
341
kernels) and @code{%pi/@var{n}} (@var{n} integer) with integer coefficients. The result is a
342
simplified fraction with numerator and denominator linear in @code{sin} and @code{cos}.
343
Thus @code{trigrat} linearize always when it is possible.
346
@c trigrat(sin(3*a)/sin(a+%pi/3));
299
349
(%i1) trigrat(sin(3*a)/sin(a+%pi/3));
350
(%o1) sqrt(3) sin(2 a) + cos(2 a) - 1
301
(%o1) sqrt(3) sin(2 a) + cos(2 a) - 1
304
Here is another example (for which the function was intended); see
305
[Davenport, Siret, Tournier, Calcul Formel, Masson (or in english,
306
Addison-Wesley), section 1.5.5, Morley theorem). Timings are on VAX 780.
354
The following example is taken from
355
Davenport, Siret, and Tournier, @i{Calcul Formel}, Masson (or in English,
356
Addison-Wesley), section 1.5.5, Morley theorem.
360
@c bc: sin(a)*sin(3*c)/sin(a+b);
362
@c ac2: ba^2 + bc^2 - 2*bc*ba*cos(b);
315
(%i5) bc:sin(a)*sin(3*c)/sin(a+b);
317
sin(a) sin(3 b + 3 a)
318
(%o5) ---------------------
323
(%i7) ac2:ba^2+bc^2-2*bc*ba*cos(b);
326
sin (a) sin (3 b + 3 a)
327
(%o7) -----------------------
366
(%i1) c: %pi/3 - a - b;
370
(%i2) bc: sin(a)*sin(3*c)/sin(a+b);
371
sin(a) sin(3 b + 3 a)
372
(%o2) ---------------------
374
(%i3) ba: bc, c=a, a=c$
375
(%i4) ac2: ba^2 + bc^2 - 2*bc*ba*cos(b);
377
sin (a) sin (3 b + 3 a)
378
(%o4) -----------------------
332
383
2 sin(a) sin(3 a) cos(b) sin(b + a - ---) sin(3 b + 3 a)
334
385
- --------------------------------------------------------
336
sin(a - ---) sin(b + a)
387
sin(a - ---) sin(b + a)
340
391
sin (3 a) sin (b + a - ---)
342
393
+ ---------------------------
348
Totaltime= 65866 msec. GCtime= 7716 msec.
351
- (sqrt(3) sin(4 b + 4 a) - cos(4 b + 4 a)
353
- 2 sqrt(3) sin(4 b + 2 a)
355
+ 2 cos(4 b + 2 a) - 2 sqrt(3) sin(2 b + 4 a) + 2 cos(2 b + 4 a)
357
+ 4 sqrt(3) sin(2 b + 2 a) - 8 cos(2 b + 2 a) - 4 cos(2 b - 2 a)
359
+ sqrt(3) sin(4 b) - cos(4 b) - 2 sqrt(3) sin(2 b) + 10 cos(2 b)
361
+ sqrt(3) sin(4 a) - cos(4 a) - 2 sqrt(3) sin(2 a) + 10 cos(2 a)
398
(%o5) - (sqrt(3) sin(4 b + 4 a) - cos(4 b + 4 a)
400
- 2 sqrt(3) sin(4 b + 2 a) + 2 cos(4 b + 2 a)
402
- 2 sqrt(3) sin(2 b + 4 a) + 2 cos(2 b + 4 a)
404
+ 4 sqrt(3) sin(2 b + 2 a) - 8 cos(2 b + 2 a) - 4 cos(2 b - 2 a)
406
+ sqrt(3) sin(4 b) - cos(4 b) - 2 sqrt(3) sin(2 b) + 10 cos(2 b)
408
+ sqrt(3) sin(4 a) - cos(4 a) - 2 sqrt(3) sin(2 a) + 10 cos(2 a)