Mercurial > hg > octave-nkf
annotate doc/interpreter/arith.txi @ 7638:2df457529cfa
implement expm1 and log1p functions
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 25 Mar 2008 19:47:21 -0400 |
parents | fd42779a8428 |
children | bbaa5d7d0143 |
rev | line source |
---|---|
7018 | 1 @c Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2007 John W. Eaton |
2 @c | |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
3294 | 18 |
4167 | 19 @node Arithmetic |
3294 | 20 @chapter Arithmetic |
21 | |
22 Unless otherwise noted, all of the functions described in this chapter | |
23 will work for real and complex scalar or matrix arguments. | |
24 | |
25 @menu | |
26 * Utility Functions:: | |
27 * Complex Arithmetic:: | |
28 * Trigonometry:: | |
29 * Sums and Products:: | |
30 * Special Functions:: | |
3803 | 31 * Coordinate Transformations:: |
3294 | 32 * Mathematical Constants:: |
33 @end menu | |
34 | |
4169 | 35 @node Utility Functions |
3294 | 36 @section Utility Functions |
37 | |
38 The following functions are available for working with complex numbers. | |
39 Each expects a single argument. They are called @dfn{mapping functions} | |
40 because when given a matrix argument, they apply the given function to | |
41 each element of the matrix. | |
42 | |
3321 | 43 @DOCSTRING(ceil) |
3294 | 44 |
6550 | 45 @DOCSTRING(cplxpair) |
46 | |
6788 | 47 @DOCSTRING(del2) |
48 | |
3321 | 49 @DOCSTRING(exp) |
3294 | 50 |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
51 @DOCSTRING(expm1) |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
52 |
6550 | 53 @DOCSTRING(factor) |
54 | |
55 @DOCSTRING(factorial) | |
56 | |
3321 | 57 @DOCSTRING(fix) |
3294 | 58 |
3321 | 59 @DOCSTRING(floor) |
3294 | 60 |
6550 | 61 @DOCSTRING(fmod) |
62 | |
3321 | 63 @DOCSTRING(gcd) |
3294 | 64 |
6551 | 65 @DOCSTRING(gradient) |
66 | |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
67 @DOCSTRING(hypot) |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
68 |
3321 | 69 @DOCSTRING(lcm) |
3294 | 70 |
3321 | 71 @DOCSTRING(log) |
3294 | 72 |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
73 @DOCSTRING(log1p) |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
74 |
3321 | 75 @DOCSTRING(log10) |
3294 | 76 |
3321 | 77 @DOCSTRING(log2) |
3294 | 78 |
3321 | 79 @DOCSTRING(max) |
3294 | 80 |
3321 | 81 @DOCSTRING(min) |
82 | |
3982 | 83 @DOCSTRING(mod) |
84 | |
3321 | 85 @DOCSTRING(nextpow2) |
3294 | 86 |
6550 | 87 @DOCSTRING(nthroot) |
88 | |
3321 | 89 @DOCSTRING(pow2) |
3294 | 90 |
6550 | 91 @DOCSTRING(primes) |
92 | |
3321 | 93 @DOCSTRING(rem) |
3294 | 94 |
3321 | 95 @DOCSTRING(round) |
3294 | 96 |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
97 @DOCSTRING(roundb) |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7018
diff
changeset
|
98 |
3321 | 99 @DOCSTRING(sign) |
3294 | 100 |
3321 | 101 @DOCSTRING(sqrt) |
3294 | 102 |
4169 | 103 @node Complex Arithmetic |
3294 | 104 @section Complex Arithmetic |
105 | |
106 The following functions are available for working with complex | |
107 numbers. Each expects a single argument. Given a matrix they work on | |
108 an element by element basis. In the descriptions of the following | |
109 functions, | |
110 @iftex | |
111 @tex | |
112 $z$ is the complex number $x + iy$, where $i$ is defined as | |
113 $\sqrt{-1}$. | |
114 @end tex | |
115 @end iftex | |
116 @ifinfo | |
117 @var{z} is the complex number @var{x} + @var{i}@var{y}, where @var{i} is | |
118 defined as @code{sqrt (-1)}. | |
119 @end ifinfo | |
120 | |
3321 | 121 @DOCSTRING(abs) |
3294 | 122 |
3321 | 123 @DOCSTRING(arg) |
3294 | 124 |
3321 | 125 @DOCSTRING(conj) |
3294 | 126 |
3321 | 127 @DOCSTRING(imag) |
3294 | 128 |
3321 | 129 @DOCSTRING(real) |
3294 | 130 |
4169 | 131 @node Trigonometry |
3294 | 132 @section Trigonometry |
133 | |
134 Octave provides the following trigonometric functions. Angles are | |
6939 | 135 specified in radians. To convert from degrees to radians multiply by |
3294 | 136 @iftex |
137 @tex | |
138 $\pi/180$ | |
139 @end tex | |
140 @end iftex | |
141 @ifinfo | |
142 @code{pi/180} | |
143 @end ifinfo | |
144 (e.g. @code{sin (30 * pi/180)} returns the sine of 30 degrees). | |
145 | |
3321 | 146 @DOCSTRING(sin) |
147 @DOCSTRING(cos) | |
148 @DOCSTRING(tan) | |
149 @DOCSTRING(sec) | |
150 @DOCSTRING(csc) | |
151 @DOCSTRING(cot) | |
3294 | 152 |
3321 | 153 @DOCSTRING(asin) |
154 @DOCSTRING(acos) | |
155 @DOCSTRING(atan) | |
156 @DOCSTRING(asec) | |
157 @DOCSTRING(acsc) | |
158 @DOCSTRING(acot) | |
3294 | 159 |
3321 | 160 @DOCSTRING(sinh) |
161 @DOCSTRING(cosh) | |
162 @DOCSTRING(tanh) | |
163 @DOCSTRING(sech) | |
3428 | 164 @DOCSTRING(csch) |
3321 | 165 @DOCSTRING(coth) |
3294 | 166 |
3321 | 167 @DOCSTRING(asinh) |
168 @DOCSTRING(acosh) | |
169 @DOCSTRING(atanh) | |
170 @DOCSTRING(asech) | |
171 @DOCSTRING(acsch) | |
172 @DOCSTRING(acoth) | |
3294 | 173 |
7001 | 174 Each of these functions expects a single argument. For matrix arguments, |
3294 | 175 they work on an element by element basis. For example, |
176 | |
177 @example | |
178 @group | |
179 sin ([1, 2; 3, 4]) | |
180 @result{} 0.84147 0.90930 | |
181 0.14112 -0.75680 | |
182 @end group | |
183 @end example | |
184 | |
3321 | 185 @DOCSTRING(atan2) |
186 | |
6502 | 187 In addition to the trigonometric functions that work with radians, |
188 Octave also provides the following functions which work with degrees. | |
189 | |
190 @DOCSTRING(sind) | |
191 @DOCSTRING(cosd) | |
192 @DOCSTRING(tand) | |
193 @DOCSTRING(secd) | |
194 @DOCSTRING(cscd) | |
195 @DOCSTRING(cotd) | |
196 | |
197 @DOCSTRING(asind) | |
198 @DOCSTRING(acosd) | |
199 @DOCSTRING(atand) | |
200 @DOCSTRING(asecd) | |
201 @DOCSTRING(acscd) | |
202 @DOCSTRING(acotd) | |
3294 | 203 |
4169 | 204 @node Sums and Products |
3294 | 205 @section Sums and Products |
206 | |
3321 | 207 @DOCSTRING(sum) |
3294 | 208 |
3321 | 209 @DOCSTRING(prod) |
3294 | 210 |
3321 | 211 @DOCSTRING(cumsum) |
3294 | 212 |
3321 | 213 @DOCSTRING(cumprod) |
3294 | 214 |
3321 | 215 @DOCSTRING(sumsq) |
3294 | 216 |
6770 | 217 @DOCSTRING(accumarray) |
218 | |
4169 | 219 @node Special Functions |
3294 | 220 @section Special Functions |
221 | |
3459 | 222 @DOCSTRING(besselj) |
223 | |
224 @DOCSTRING(airy) | |
3294 | 225 |
3321 | 226 @DOCSTRING(beta) |
3294 | 227 |
3444 | 228 @DOCSTRING(betainc) |
3294 | 229 |
6502 | 230 @DOCSTRING(betaln) |
231 | |
3321 | 232 @DOCSTRING(bincoeff) |
3294 | 233 |
3321 | 234 @DOCSTRING(erf) |
3294 | 235 |
3321 | 236 @DOCSTRING(erfc) |
3294 | 237 |
3321 | 238 @DOCSTRING(erfinv) |
3294 | 239 |
3321 | 240 @DOCSTRING(gamma) |
3294 | 241 |
3444 | 242 @DOCSTRING(gammainc) |
3294 | 243 |
6502 | 244 @DOCSTRING(legendre) |
245 | |
3321 | 246 @DOCSTRING(lgamma) |
247 | |
248 @DOCSTRING(cross) | |
3294 | 249 |
3321 | 250 @DOCSTRING(commutation_matrix) |
3294 | 251 |
3321 | 252 @DOCSTRING(duplication_matrix) |
3294 | 253 |
4169 | 254 @node Coordinate Transformations |
3803 | 255 @section Coordinate Transformations |
256 | |
257 @DOCSTRING(cart2pol) | |
258 | |
259 @DOCSTRING(pol2cart) | |
260 | |
261 @DOCSTRING(cart2sph) | |
262 | |
263 @DOCSTRING(sph2cart) | |
264 | |
4169 | 265 @node Mathematical Constants |
3294 | 266 @section Mathematical Constants |
267 | |
3321 | 268 @DOCSTRING(I) |
269 | |
270 @DOCSTRING(Inf) | |
3294 | 271 |
3321 | 272 @DOCSTRING(NaN) |
3294 | 273 |
3321 | 274 @DOCSTRING(pi) |
3294 | 275 |
3321 | 276 @DOCSTRING(e) |
277 | |
278 @DOCSTRING(eps) | |
3294 | 279 |
3321 | 280 @DOCSTRING(realmax) |
3294 | 281 |
3321 | 282 @DOCSTRING(realmin) |