~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to doc/info/Trigonometric.texi

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
1
2
@menu
2
3
* Introduction to Trigonometric::  
3
4
* Definitions for Trigonometric::  
5
6
 
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
 
9
 
 
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})}
 
24
for details.
18
25
 
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
23
 
 
24
 
@defun ACOS
25
 
 - Arc Cosine
26
 
 
27
 
@end defun
28
 
@c @node ACOSH
29
 
@c @unnumberedsec phony
30
 
@defun ACOSH
31
 
 - Hyperbolic Arc Cosine
32
 
 
33
 
@end defun
34
 
@c @node ACOT
35
 
@c @unnumberedsec phony
36
 
@defun ACOT
37
 
 - Arc Cotangent
38
 
 
39
 
@end defun
40
 
@c @node ACOTH
41
 
@c @unnumberedsec phony
42
 
@defun ACOTH
43
 
 - Hyperbolic Arc Cotangent
44
 
 
45
 
@end defun
46
 
@c @node ACSC
47
 
@c @unnumberedsec phony
48
 
@defun ACSC
49
 
 - Arc Cosecant
50
 
 
51
 
@end defun
52
 
@c @node ACSCH
53
 
@c @unnumberedsec phony
54
 
@defun ACSCH
55
 
 - Hyperbolic Arc Cosecant
56
 
 
57
 
@end defun
58
 
@c @node ASEC
59
 
@c @unnumberedsec phony
60
 
@defun ASEC
61
 
 - Arc Secant
62
 
 
63
 
@end defun
64
 
@c @node ASECH
65
 
@c @unnumberedsec phony
66
 
@defun ASECH
67
 
 - Hyperbolic Arc Secant
68
 
 
69
 
@end defun
70
 
@c @node ASIN
71
 
@c @unnumberedsec phony
72
 
@defun ASIN
73
 
 - Arc Sine
74
 
 
75
 
@end defun
76
 
@c @node ASINH
77
 
@c @unnumberedsec phony
78
 
@defun ASINH
79
 
 - Hyperbolic Arc Sine
80
 
 
81
 
@end defun
82
 
@c @node ATAN
83
 
@c @unnumberedsec phony
84
 
@defun ATAN
85
 
 - Arc Tangent
86
 
 
87
 
@end defun
88
 
@c @node ATAN2
89
 
@c @unnumberedsec phony
90
 
@defun ATAN2 (Y,X)
91
 
yields the value of ATAN(Y/X) in the interval -%PI to
92
 
%PI.
93
 
 
94
 
@end defun
95
 
@c @node ATANH
96
 
@c @unnumberedsec phony
97
 
@defun ATANH
98
 
 - Hyperbolic Arc Tangent
99
 
 
100
 
@end defun
101
 
@c @node ATRIG1
102
 
@c @unnumberedsec phony
103
 
@defun ATRIG1
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.
109
 
 
110
 
@end defun
111
 
@c @node COS
112
 
@c @unnumberedsec phony
113
 
@defun COS
114
 
 - Cosine
115
 
 
116
 
@end defun
117
 
@c @node COSH
118
 
@c @unnumberedsec phony
119
 
@defun COSH
120
 
 - Hyperbolic Cosine
121
 
 
122
 
@end defun
123
 
@c @node COT
124
 
@c @unnumberedsec phony
125
 
@defun COT
126
 
 - Cotangent
127
 
 
128
 
@end defun
129
 
@c @node COTH
130
 
@c @unnumberedsec phony
131
 
@defun COTH
132
 
 - Hyperbolic Cotangent
133
 
 
134
 
@end defun
135
 
@c @node CSC
136
 
@c @unnumberedsec phony
137
 
@defun CSC
138
 
 - Cosecant
139
 
 
140
 
@end defun
141
 
@c @node CSCH
142
 
@c @unnumberedsec phony
143
 
@defun CSCH
144
 
 - Hyperbolic Cosecant
145
 
 
146
 
@end defun
147
 
@c @node HALFANGLES
148
 
@c @unnumberedsec phony
149
 
@defvar HALFANGLES
150
 
 default: [FALSE] - if TRUE causes half-angles to be
151
 
simplified away.
152
 
 
153
 
@end defvar
154
 
@c @node SEC
155
 
@c @unnumberedsec phony
156
 
@defun SEC
157
 
 - Secant
158
 
 
159
 
@end defun
160
 
@c @node SECH
161
 
@c @unnumberedsec phony
162
 
@defun SECH
163
 
 - Hyperbolic Secant
164
 
 
165
 
@end defun
166
 
@c @node SIN
167
 
@c @unnumberedsec phony
168
 
@defun SIN
169
 
 - Sine
170
 
 
171
 
@end defun
172
 
@c @node SINH
173
 
@c @unnumberedsec phony
174
 
@defun SINH
175
 
 - Hyperbolic Sine
176
 
 
177
 
@end defun
178
 
@c @node TAN
179
 
@c @unnumberedsec phony
180
 
@defun TAN
181
 
 - Tangent
182
 
 
183
 
@end defun
184
 
@c @node TANH
185
 
@c @unnumberedsec phony
186
 
@defun TANH
187
 
 - Hyperbolic Tangent
188
 
 
189
 
@end defun
190
 
@c @node TRIGEXPAND
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
 
28
 
 
29
@deffn {Function} acos (@var{x})
 
30
 - Arc Cosine.
 
31
 
 
32
@end deffn
 
33
 
 
34
@deffn {Function} acosh (@var{x})
 
35
 - Hyperbolic Arc Cosine.
 
36
 
 
37
@end deffn
 
38
 
 
39
@deffn {Function} acot (@var{x})
 
40
 - Arc Cotangent.
 
41
 
 
42
@end deffn
 
43
 
 
44
@deffn {Function} acoth (@var{x})
 
45
 - Hyperbolic Arc Cotangent.
 
46
 
 
47
@end deffn
 
48
 
 
49
@deffn {Function} acsc (@var{x})
 
50
 - Arc Cosecant.
 
51
 
 
52
@end deffn
 
53
 
 
54
@deffn {Function} acsch (@var{x})
 
55
 - Hyperbolic Arc Cosecant.
 
56
 
 
57
@end deffn
 
58
 
 
59
@deffn {Function} asec (@var{x})
 
60
 - Arc Secant.
 
61
 
 
62
@end deffn
 
63
 
 
64
@deffn {Function} asech (@var{x})
 
65
 - Hyperbolic Arc Secant.
 
66
 
 
67
@end deffn
 
68
 
 
69
@deffn {Function} asin (@var{x})
 
70
 - Arc Sine.
 
71
 
 
72
@end deffn
 
73
 
 
74
@deffn {Function} asinh (@var{x})
 
75
 - Hyperbolic Arc Sine.
 
76
 
 
77
@end deffn
 
78
 
 
79
@deffn {Function} atan (@var{x})
 
80
 - Arc Tangent.
 
81
 
 
82
@end deffn
 
83
 
 
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
 
86
@code{%pi}.
 
87
 
 
88
@end deffn
 
89
 
 
90
@deffn {Function} atanh (@var{x})
 
91
 - Hyperbolic Arc Tangent.
 
92
 
 
93
@end deffn
 
94
 
 
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.
 
104
 
 
105
@end defvr
 
106
 
 
107
@deffn {Function} cos (@var{x})
 
108
 - Cosine.
 
109
 
 
110
@end deffn
 
111
 
 
112
@deffn {Function} cosh (@var{x})
 
113
 - Hyperbolic Cosine.
 
114
 
 
115
@end deffn
 
116
 
 
117
@deffn {Function} cot (@var{x})
 
118
 - Cotangent.
 
119
 
 
120
@end deffn
 
121
 
 
122
@deffn {Function} coth (@var{x})
 
123
 - Hyperbolic Cotangent.
 
124
 
 
125
@end deffn
 
126
 
 
127
@deffn {Function} csc (@var{x})
 
128
 - Cosecant.
 
129
 
 
130
@end deffn
 
131
 
 
132
@deffn {Function} csch (@var{x})
 
133
 - Hyperbolic Cosecant.
 
134
 
 
135
@end deffn
 
136
 
 
137
@defvr {Option variable} halfangles
 
138
Default value: @code{false}
 
139
 
 
140
When @code{halfangles} is @code{true},
 
141
half-angles are simplified away.
 
142
@c WHAT DOES THIS STATEMENT MEAN EXACTLY ??
 
143
@c NEEDS EXAMPLES
 
144
 
 
145
@end defvr
 
146
 
 
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 ??
 
155
 
 
156
@end defvr
 
157
 
 
158
@deffn {Function} sec (@var{x})
 
159
 - Secant.
 
160
 
 
161
@end deffn
 
162
 
 
163
@deffn {Function} sech (@var{x})
 
164
 - Hyperbolic Secant.
 
165
 
 
166
@end deffn
 
167
 
 
168
@deffn {Function} sin (@var{x})
 
169
 - Sine.
 
170
 
 
171
@end deffn
 
172
 
 
173
@deffn {Function} sinh (@var{x})
 
174
 - Hyperbolic Sine.
 
175
 
 
176
@end deffn
 
177
 
 
178
@deffn {Function} tan (@var{x})
 
179
 - Tangent.
 
180
 
 
181
@end deffn
 
182
 
 
183
@deffn {Function} tanh (@var{x})
 
184
 - Hyperbolic Tangent.
 
185
 
 
186
@end deffn
 
187
 
 
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}.
 
196
 
 
197
@code{trigexpand} is governed by the following global flags:
 
198
 
 
199
@table @code
 
200
@item trigexpand
 
201
If @code{true} causes expansion of all
 
202
expressions containing sin's and cos's occurring subsequently.
 
203
@item halfangles
 
204
If @code{true} causes half-angles to be simplified
 
205
away.
 
206
@item trigexpandplus
 
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}.
 
214
@end table
 
215
 
 
216
Examples:
 
217
 
 
218
@c ===beg===
 
219
@c x+sin(3*x)/sin(x),trigexpand=true,expand;
 
220
@c trigexpand(sin(10*x+y));
 
221
@c ===end===
208
222
@example
209
 
(%i1) X+SIN(3*X)/SIN(X),TRIGEXPAND=TRUE,EXPAND;
210
 
                              2           2
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)
214
 
 
 
223
(%i1) x+sin(3*x)/sin(x),trigexpand=true,expand;
 
224
                         2           2
 
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)
215
228
 
216
229
@end example
217
 
@end defun
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.
225
 
 
226
 
@end defvar
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.
234
 
 
235
 
@end defvar
236
 
@c @node TRIGINVERSES
237
 
@c @unnumberedsec phony
238
 
@defvar TRIGINVERSES
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))
 
230
 
 
231
@end deffn
 
232
 
 
233
@defvr {Option variable} trigexpandplus
 
234
Default value: @code{true}
 
235
 
 
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 
 
240
@code{true}.
 
241
 
 
242
@end defvr
 
243
 
 
244
@defvr {Option variable} trigexpandtimes
 
245
Default value: @code{true}
 
246
 
 
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}.
 
251
 
 
252
@end defvr
 
253
 
 
254
@defvr {Option variable} triginverses
 
255
Default value: @code{all}
 
256
 
 
257
@code{triginverses} controls the simplification of the
 
258
composition of trigonometric and hyperbolic functions with their inverse
 
259
functions.
 
260
 
 
261
If @code{all}, both e.g. @code{atan(tan(@var{x}))} 
 
262
and @code{tan(atan(@var{x}))} simplify to @var{x}.  
 
263
 
 
264
If @code{true}, the @code{@var{arcfun}(@var{fun}(@var{x}))} 
 
265
simplification is turned off.
 
266
 
 
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.
245
271
 
246
 
@end defvar
247
 
@c @node TRIGREDUCE
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.
 
272
@end defvr
 
273
 
 
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.
 
280
 
 
281
See also @code{poissimp}.
 
282
 
 
283
@c ===beg===
 
284
@c trigreduce(-sin(x)^2+3*cos(x)^2+x);
 
285
@c ===end===
255
286
@example
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 - -
 
290
                  2             2       2        2
 
291
 
 
292
@end example
 
293
 
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)$
263
 
(%o6)                      COS(X)
264
 
(%i7) SIN(X + (O + 1/2) %PI);
265
 
(%o7)                     - COS(X)
266
297
 
 
298
@c ===beg===
 
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);
 
302
@c ===end===
 
303
@example
 
304
(%i1) declare(j, integer, e, even, o, odd)$
 
305
(%i2) sin(x + (e + 1/2)*%pi);
 
306
(%o2)                        cos(x)
 
307
(%i3) sin(x + (o + 1/2)*%pi);
 
308
(%o3)                       - cos(x)
267
309
 
268
310
@end example
269
 
@end defun
270
 
@c @node TRIGSIGN
271
 
@c @unnumberedsec phony
272
 
@defvar TRIGSIGN
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.
276
 
 
277
 
@end defvar
278
 
@c @node TRIGSIMP
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.
286
 
 
287
 
@end defun
288
 
@c @node TRIGRAT
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).
297
 
 
 
311
 
 
312
@end deffn
 
313
 
 
314
@defvr {Option variable} trigsign
 
315
Default value: @code{true}
 
316
 
 
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}.
 
320
 
 
321
@end defvr
 
322
 
 
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}.
 
327
 
 
328
@code{trigreduce}, @code{ratsimp}, and @code{radcan} may be
 
329
able to further simplify the result.
 
330
 
 
331
@code{demo ("trgsmp.dem")} displays some examples of @code{trigsimp}.
 
332
@c MERGE EXAMPLES INTO THIS ITEM
 
333
 
 
334
@end deffn
 
335
 
 
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.
 
344
 
 
345
@c ===beg===
 
346
@c trigrat(sin(3*a)/sin(a+%pi/3));
 
347
@c ===end===
298
348
@example
299
349
(%i1) trigrat(sin(3*a)/sin(a+%pi/3));
 
350
(%o1)            sqrt(3) sin(2 a) + cos(2 a) - 1
300
351
 
301
 
(%o1)                   sqrt(3) sin(2 a) + cos(2 a) - 1
302
352
@end example
303
353
 
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.
307
357
 
 
358
@c ===beg===
 
359
@c c: %pi/3 - a - b;
 
360
@c bc: sin(a)*sin(3*c)/sin(a+b);
 
361
@c ba: bc, c=a, a=c$
 
362
@c ac2: ba^2 + bc^2 - 2*bc*ba*cos(b);
 
363
@c trigrat (ac2);
 
364
@c ===end===
308
365
@example
309
 
(%i4)   c:%pi/3-a-b;
310
 
 
311
 
                                           %pi
312
 
(%o4)                            - b - a + ---
313
 
                                            3
314
 
 
315
 
(%i5)   bc:sin(a)*sin(3*c)/sin(a+b);
316
 
 
317
 
                             sin(a) sin(3 b + 3 a)
318
 
(%o5)                        ---------------------
319
 
                                  sin(b + a)
320
 
 
321
 
(%i6)   ba:bc,c=a,a=c$
322
 
 
323
 
(%i7)   ac2:ba^2+bc^2-2*bc*ba*cos(b);
324
 
 
325
 
        2       2
326
 
     sin (a) sin (3 b + 3 a)
327
 
(%o7) -----------------------
328
 
              2
329
 
           sin (b + a)
330
 
 
331
 
                                        %pi
 
366
(%i1) c: %pi/3 - a - b;
 
367
                                    %pi
 
368
(%o1)                     - b - a + ---
 
369
                                     3
 
370
(%i2) bc: sin(a)*sin(3*c)/sin(a+b);
 
371
                      sin(a) sin(3 b + 3 a)
 
372
(%o2)                 ---------------------
 
373
                           sin(b + a)
 
374
(%i3) ba: bc, c=a, a=c$
 
375
(%i4) ac2: ba^2 + bc^2 - 2*bc*ba*cos(b);
 
376
         2       2
 
377
      sin (a) sin (3 b + 3 a)
 
378
(%o4) -----------------------
 
379
               2
 
380
            sin (b + a)
 
381
 
 
382
                                        %pi
332
383
   2 sin(a) sin(3 a) cos(b) sin(b + a - ---) sin(3 b + 3 a)
333
 
                                         3
 
384
                                         3
334
385
 - --------------------------------------------------------
335
 
                           %pi
336
 
                   sin(a - ---) sin(b + a)
337
 
                            3
 
386
                           %pi
 
387
                   sin(a - ---) sin(b + a)
 
388
                            3
338
389
 
339
 
      2         2         %pi
 
390
      2         2         %pi
340
391
   sin (3 a) sin (b + a - ---)
341
 
                           3
 
392
                           3
342
393
 + ---------------------------
343
 
             2     %pi
344
 
          sin (a - ---)
345
 
                    3
346
 
 
347
 
(%i9)   trigrat(ac2);
348
 
Totaltime= 65866 msec.  GCtime= 7716 msec.
349
 
 
350
 
(%o9)
351
 
- (sqrt(3) sin(4 b + 4 a) - cos(4 b + 4 a)
352
 
 
353
 
- 2 sqrt(3) sin(4 b + 2 a)
354
 
 
355
 
+ 2 cos(4 b + 2 a) - 2 sqrt(3) sin(2 b + 4 a) + 2 cos(2 b + 4 a)
356
 
 
357
 
+ 4 sqrt(3) sin(2 b + 2 a) - 8 cos(2 b + 2 a) - 4 cos(2 b - 2 a)
358
 
 
359
 
+ sqrt(3) sin(4 b) - cos(4 b) - 2 sqrt(3) sin(2 b) + 10 cos(2 b)
360
 
 
361
 
+ sqrt(3) sin(4 a) - cos(4 a) - 2 sqrt(3) sin(2 a) + 10 cos(2 a)
362
 
 
363
 
   - 9)/4
 
394
             2     %pi
 
395
          sin (a - ---)
 
396
                    3
 
397
(%i5) trigrat (ac2);
 
398
(%o5) - (sqrt(3) sin(4 b + 4 a) - cos(4 b + 4 a)
 
399
 
 
400
 - 2 sqrt(3) sin(4 b + 2 a) + 2 cos(4 b + 2 a)
 
401
 
 
402
 - 2 sqrt(3) sin(2 b + 4 a) + 2 cos(2 b + 4 a)
 
403
 
 
404
 + 4 sqrt(3) sin(2 b + 2 a) - 8 cos(2 b + 2 a) - 4 cos(2 b - 2 a)
 
405
 
 
406
 + sqrt(3) sin(4 b) - cos(4 b) - 2 sqrt(3) sin(2 b) + 10 cos(2 b)
 
407
 
 
408
 + sqrt(3) sin(4 a) - cos(4 a) - 2 sqrt(3) sin(2 a) + 10 cos(2 a)
 
409
 
 
410
 - 9)/4
364
411
 
365
412
@end example
366
 
@end defun
 
413
 
 
414
@end deffn
 
415