release 0.1.13
[liba.git] / lua / src / complex.h
blob961121281610f8c11c780ad2f984510c6cf96d97
1 /***
2 complex number
3 @classmod a.complex
4 */
6 #ifndef LUA_LIBA_COMPLEX_H
7 #define LUA_LIBA_COMPLEX_H
9 #include "a.h"
11 /***
12 complex number
13 @field real real part of complex number
14 @field imag imaginary part of complex number
15 @field rho the magnitude of complex number
16 @field theta the phase angle of complex number
17 @table a.complex
19 #if defined(__cplusplus)
20 extern "C" {
21 #endif /* __cplusplus */
23 /***
24 constructor for complex number from real and imaginary parts
25 @tparam[opt] number|string|a.complex real real part of complex number
26 @tparam[opt] number imag imaginary part of complex number
27 @treturn a.complex complex number userdata
28 @function new
30 int liba_complex_new(lua_State *L);
32 /***
33 constructor for complex number from rectangular Cartesian components
34 @tparam[opt] number real real part of complex number
35 @tparam[opt] number imag imaginary part of complex number
36 @treturn a.complex complex number userdata
37 @function rect
39 int liba_complex_rect(lua_State *L);
41 /***
42 constructor for complex number from polar form
43 @tparam[opt] number rho a distance from a reference point
44 @tparam[opt] number theta an angle from a reference direction
45 @treturn a.complex complex number userdata
46 @function polar
48 int liba_complex_polar(lua_State *L);
50 /***
51 complex number self is equal to complex number that
52 @tparam a.complex that complex number
53 @treturn bool result of comparison
54 @function eq
56 int liba_complex_eq(lua_State *L);
58 /***
59 complex number self is not equal to complex number that
60 @tparam a.complex that complex number
61 @treturn bool result of comparison
62 @function ne
64 int liba_complex_ne(lua_State *L);
66 /***
67 computes the natural logarithm of magnitude of a complex number
68 @treturn number log|z|
69 @function logabs
71 int liba_complex_logabs(lua_State *L);
73 /***
74 computes the squared magnitude of a complex number
75 @treturn number a^2+b^2
76 @function abs2
78 int liba_complex_abs2(lua_State *L);
80 /***
81 computes the magnitude of a complex number
82 @treturn number sqrt{a^2+b^2}
83 @function abs
85 int liba_complex_abs(lua_State *L);
87 /***
88 computes the phase angle of a complex number
89 @treturn number arctan(b/a)
90 @function arg
92 int liba_complex_arg(lua_State *L);
94 /***
95 computes the projection on Riemann sphere
96 @treturn a.complex complex number userdata
97 @function proj
99 int liba_complex_proj(lua_State *L);
101 /***
102 computes the complex conjugate
103 @treturn a.complex complex number userdata
104 @function conj
106 int liba_complex_conj(lua_State *L);
108 /***
109 computes the complex negative
110 @treturn a.complex complex number userdata
111 @function unm
113 int liba_complex_neg(lua_State *L);
115 /***
116 inverse of a complex number
117 @treturn a.complex complex number userdata
118 @function inv
120 int liba_complex_inv(lua_State *L);
122 /***
123 addition of complex numbers
124 @tparam a.complex z complex number userdata
125 @treturn a.complex complex number userdata
126 @function add
128 int liba_complex_add(lua_State *L);
130 /***
131 subtraction of complex numbers
132 @tparam a.complex z complex number userdata
133 @treturn a.complex complex number userdata
134 @function sub
136 int liba_complex_sub(lua_State *L);
138 /***
139 multiplication of complex numbers
140 @tparam a.complex z complex number userdata
141 @treturn a.complex complex number userdata
142 @function mul
144 int liba_complex_mul(lua_State *L);
146 /***
147 division of complex numbers
148 @tparam a.complex z complex number userdata
149 @treturn a.complex complex number userdata
150 @function div
152 int liba_complex_div(lua_State *L);
154 /***
155 complex number z raised to complex power a
156 @tparam a.complex a complex number userdata
157 @treturn a.complex complex number userdata
158 @function pow
160 int liba_complex_pow(lua_State *L);
162 /***
163 computes the complex base-b logarithm
164 @tparam a.complex b complex number userdata
165 @treturn a.complex complex number userdata
166 @function logb
168 int liba_complex_logb(lua_State *L);
170 /***
171 computes the complex base-e exponential
172 @treturn a.complex complex number userdata
173 @function exp
175 int liba_complex_exp(lua_State *L);
177 /***
178 computes the complex natural logarithm
179 @treturn a.complex complex number userdata
180 @function log
182 int liba_complex_log(lua_State *L);
184 /***
185 computes the complex square root
186 @treturn a.complex complex number userdata
187 @function sqrt
189 int liba_complex_sqrt(lua_State *L);
191 /***
192 computes the complex base-2 logarithm
193 @treturn a.complex complex number userdata
194 @function log2
196 int liba_complex_log2(lua_State *L);
198 /***
199 computes the complex base-10 logarithm
200 @treturn a.complex complex number userdata
201 @function log10
203 int liba_complex_log10(lua_State *L);
205 /***
206 computes the complex sine
207 @treturn a.complex complex number userdata
208 @function sin
210 int liba_complex_sin(lua_State *L);
212 /***
213 computes the complex cosine
214 @treturn a.complex complex number userdata
215 @function cos
217 int liba_complex_cos(lua_State *L);
219 /***
220 computes the complex tangent
221 @treturn a.complex complex number userdata
222 @function tan
224 int liba_complex_tan(lua_State *L);
226 /***
227 computes the complex secant
228 @treturn a.complex complex number userdata
229 @function sec
231 int liba_complex_sec(lua_State *L);
233 /***
234 computes the complex cosecant
235 @treturn a.complex complex number userdata
236 @function csc
238 int liba_complex_csc(lua_State *L);
240 /***
241 computes the complex cotangent
242 @treturn a.complex complex number userdata
243 @function cot
245 int liba_complex_cot(lua_State *L);
247 /***
248 computes the complex arc sine
249 @treturn a.complex complex number userdata
250 @function asin
252 int liba_complex_asin(lua_State *L);
254 /***
255 computes the complex arc cosine
256 @treturn a.complex complex number userdata
257 @function acos
259 int liba_complex_acos(lua_State *L);
261 /***
262 computes the complex arc tangent
263 @treturn a.complex complex number userdata
264 @function atan
266 int liba_complex_atan(lua_State *L);
268 /***
269 computes the complex arc secant
270 @treturn a.complex complex number userdata
271 @function asec
273 int liba_complex_asec(lua_State *L);
275 /***
276 computes the complex arc cosecant
277 @treturn a.complex complex number userdata
278 @function acsc
280 int liba_complex_acsc(lua_State *L);
282 /***
283 computes the complex arc cotangent
284 @treturn a.complex complex number userdata
285 @function acot
287 int liba_complex_acot(lua_State *L);
289 /***
290 computes the complex hyperbolic sine
291 @treturn a.complex complex number userdata
292 @function sinh
294 int liba_complex_sinh(lua_State *L);
296 /***
297 computes the complex hyperbolic cosine
298 @treturn a.complex complex number userdata
299 @function cosh
301 int liba_complex_cosh(lua_State *L);
303 /***
304 computes the complex hyperbolic tangent
305 @treturn a.complex complex number userdata
306 @function tanh
308 int liba_complex_tanh(lua_State *L);
310 /***
311 computes the complex hyperbolic secant
312 @treturn a.complex complex number userdata
313 @function sech
315 int liba_complex_sech(lua_State *L);
317 /***
318 computes the complex hyperbolic cosecant
319 @treturn a.complex complex number userdata
320 @function csch
322 int liba_complex_csch(lua_State *L);
324 /***
325 computes the complex hyperbolic cotangent
326 @treturn a.complex complex number userdata
327 @function coth
329 int liba_complex_coth(lua_State *L);
331 /***
332 computes the complex arc hyperbolic sine
333 @treturn a.complex complex number userdata
334 @function asinh
336 int liba_complex_asinh(lua_State *L);
338 /***
339 computes the complex arc hyperbolic cosine
340 @treturn a.complex complex number userdata
341 @function acosh
343 int liba_complex_acosh(lua_State *L);
345 /***
346 computes the complex arc hyperbolic tangent
347 @treturn a.complex complex number userdata
348 @function atanh
350 int liba_complex_atanh(lua_State *L);
352 /***
353 computes the complex arc hyperbolic secant
354 @treturn a.complex complex number userdata
355 @function asech
357 int liba_complex_asech(lua_State *L);
359 /***
360 computes the complex arc hyperbolic cosecant
361 @treturn a.complex complex number userdata
362 @function acsch
364 int liba_complex_acsch(lua_State *L);
366 /***
367 computes the complex arc hyperbolic cotangent
368 @treturn a.complex complex number userdata
369 @function acoth
371 int liba_complex_acoth(lua_State *L);
373 #if defined(__cplusplus)
374 } /* extern "C" */
375 #endif /* __cplusplus */
377 #endif /* complex.h */