aboutsummaryrefslogtreecommitdiffhomepage
path: root/libslang/doc/tm/rtl/math.tm
blob: 104589fa7ac35f92c4676e56f7c9583d9862fcb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
\function{Conj}
\synopsis{Compute the complex conjugate of a number}
\usage{z1 = Conj (z)}
\description
  The \var{Conj} function returns the complex conjugate of a number.
  If its argument is an array, the \var{Conj} function will be applied to each
  element and the result returned as an array.
\seealso{Real, Imag, abs}
\done

\function{Imag}
\synopsis{Compute the imaginary part of a number}
\usage{i = Imag (z)}
\description
  The \var{Imag} function returns the imaginary part of a number.
  If its argument is an array, the \var{Imag} function will be applied to each
  element and the result returned as an array.
\seealso{Real, Conj, abs}
\done

\function{Real}
\synopsis{Compute the real part of a number}
\usage{r = Real (z)}
\description
  The \var{Real} function returns the real part of a number. If its
  argument is an array, the \var{Real} function will be applied to
  each element and the result returned as an array.
\seealso{Imag, Conj, abs}
\done

\function{abs}
\synopsis{Compute the absolute value of a number}
\usage{y = abs(x)}
\description
  The \var{abs} function returns the absolute value of an arithmetic
  type.  If its argument is a complex number (\var{Complex_Type}),
  then it returns the modulus.  If the argument is an array, a new
  array will be created whose elements are obtained from the original
  array by using the \var{abs} function.
\seealso{sign, sqr}
\done

\function{acos}
\synopsis{Compute the arc-cosine of an number}
\usage{y = acos (x)}
\description
  The \var{acos} function computes the arc-cosine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{acos} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{acosh}
\synopsis{Compute the inverse cosh of an number}
\usage{y = acosh (x)}
\description
  The \var{acosh} function computes the inverse cosh of a number and
  returns the result as an array.  If its argument is an array, the
  \var{acosh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{asin}
\synopsis{Compute the arc-sine of an number}
\usage{y = asin (x)}
\description
  The \var{asin} function computes the arc-sine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{asin} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{asinh}
\synopsis{Compute the inverse-sinh of an number}
\usage{y = asinh (x)}
\description
  The \var{asinh} function computes the inverse-sinh of a number and
  returns the result as an array.  If its argument is an array, the
  \var{asinh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{atan}
\synopsis{Compute the arc-tangent of an number}
\usage{y = atan (x)}
\description
  The \var{atan} function computes the arc-tangent of a number and
  returns the result as an array.  If its argument is an array, the
  \var{atan} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{atanh}
\synopsis{Compute the inverse-tanh of an number}
\usage{y = atanh (x)}
\description
  The \var{atanh} function computes the inverse-tanh of a number and
  returns the result as an array.  If its argument is an array, the
  \var{atanh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{cos}
\synopsis{Compute the cosine of an number}
\usage{y = cos (x)}
\description
  The \var{cos} function computes the cosine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{cos} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{cosh}
\synopsis{Compute the hyperbolic cosine of an number}
\usage{y = cosh (x)}
\description
  The \var{cosh} function computes the hyperbolic cosine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{cosh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{exp}
\synopsis{Compute the exponential of an number}
\usage{y = exp (x)}
\description
  The \var{exp} function computes the exponential of a number and
  returns the result as an array.  If its argument is an array, the
  \var{exp} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{log}
\synopsis{Compute the logarithm of an number}
\usage{y = log (x)}
\description
  The \var{log} function computes the logarithm of a number and
  returns the result as an array.  If its argument is an array, the
  \var{log} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{log10}
\synopsis{Compute the base-10 logarithm of an number}
\usage{y = log10 (x)}
\description
  The \var{log10} function computes the base-10 logarithm of a number and
  returns the result as an array.  If its argument is an array, the
  \var{log10} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{mul2}
\synopsis{Multiply a number by 2}
\usage{y = mul2(x)}
\description
  The \var{mul2} function multiplies an arithmetic type by two and
  returns the result.  If its argument is an array, a new array will
  be created whose elements are obtained from the original array by
  using the \var{mul2} function.
\seealso{sqr, abs}
\done

\function{polynom}
\synopsis{Evaluate a polynomial}
\usage{Double_Type polynom(Double_Type a, b, ...c, Integer_Type n, Double_Type x)}
\description
  The \var{polynom} function returns the value of the polynomial expression:
#v+
     ax^n + bx^(n - 1) + ... c
#v-
\notes
  The \var{polynom} function should be extended to work with complex
  and array data types.  The current implementation is limited to
  \var{Double_Type} quantities.
\seealso{exp}
\done

\function{set_float_format}
\synopsis{Set the format for printing floating point values.}
\usage{set_float_format (String_Type fmt)}
\description
  The \var{set_float_format} function is used to set the floating
  point format to be used when floating point numbers are printed.
  The routines that use this are the traceback routines and the
  \var{string} function. The default value is \exmp{"%f"}
\example
#v+
     s = string (PI);                %  --> s = "3.14159"
     set_float_format ("%16.10f");
     s = string (PI);                %  --> s = "3.1415926536"
     set_float_format ("%10.6e");
     s = string (PI);                %  --> s = "3.141593e+00"
#v-
\seealso{string, sprintf, double}
\done

\function{sign}
\synopsis{Compute the sign of a number}
\usage{y = sign(x)}
\description
  The \var{sign} function returns the sign of an arithmetic type.  If
  its argument is a complex number (\var{Complex_Type}), it returns
  the sign of the imaginary part of the number. If the argument is an
  array, a new array will be created whose elements are obtained from
  the original array by using the \var{sign} function.
  
  When applied to a real number or an integer, the \var{sign} function
  returns \-1, \0, or \exmp{+1} according to whether the number is
  less than zero, equal to zero, or greater than zero, respectively.
\seealso{abs}
\done

\function{sin}
\synopsis{Compute the sine of an number}
\usage{y = sin (x)}
\description
  The \var{sin} function computes the sine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{sin} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{sinh}
\synopsis{Compute the hyperbolic sine of an number}
\usage{y = sinh (x)}
\description
  The \var{sinh} function computes the hyperbolic sine of a number and
  returns the result as an array.  If its argument is an array, the
  \var{sinh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{sqr}
\synopsis{Compute the square of a number}
\usage{y = sqr(x)}
\description
  The \var{sqr} function returns the square of an arithmetic type.  If its
  argument is a complex number (\var{Complex_Type}), then it returns
  the square of the modulus.  If the argument is an array, a new array
  will be created whose elements are obtained from the original array
  by using the \var{sqr} function.
\seealso{abs, mul2}
\done

\function{sqrt}
\synopsis{Compute the square root of an number}
\usage{y = sqrt (x)}
\description
  The \var{sqrt} function computes the square root of a number and
  returns the result as an array.  If its argument is an array, the
  \var{sqrt} function will be applied to each element and the result returned
  as an array.
\seealso{sqr, cos, atan, acosh, cosh}
\done

\function{tan}
\synopsis{Compute the tangent of an number}
\usage{y = tan (x)}
\description
  The \var{tan} function computes the tangent of a number and
  returns the result as an array.  If its argument is an array, the
  \var{tan} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done

\function{tanh}
\synopsis{Compute the hyperbolic tangent of an number}
\usage{y = tanh (x)}
\description
  The \var{tanh} function computes the hyperbolic tangent of a number and
  returns the result as an array.  If its argument is an array, the
  \var{tanh} function will be applied to each element and the result returned
  as an array.
\seealso{cos, atan, acosh, cosh}
\done