![]() |
Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Classes | |
| struct | Complex |
| Internal structure. You should not call it directly, use API instead ! More... | |
Functions | |
| std_cAdd (c1, c2) | |
| Add two complex numbers. | |
| std_cAddNew (c1, c2) | |
| Add two complex numbers. The return is a new complex number. | |
| std_cArg (c, flag) | |
| Get the argument of a complex number. | |
| std_cCmp (c1, c2) | |
| Compare two complex numbers. | |
| std_cConjugate (c) | |
| Create the conjugate of a complex number. | |
| std_cDiv (c1, c2) | |
| Divide two complex numbers. | |
| std_cDivNew (c1, c2) | |
| Divide two complex numbers. The return is a new complex number. | |
| std_cEuler (f) | |
| Exponentiation by the Euler's formula : e power fi where i is the imaginary unit (i² = -1) and f is a real number (here, f is a floatting point number). | |
| std_cFromS (szC) | |
| Create a new Complex from a literal string (such as "a + bi") | |
| std_cGet (c) | |
| Get a complex number. | |
| std_cGetImg (c) | |
| Get the imaginary part of a complex number. | |
| std_cGetReal (c) | |
| Get the real part of a complex number. | |
| std_cInv (c) | |
| Returns the inverse of a complex number. | |
| std_cInvNew (c) | |
| Returns the inverse of a complex number. This is a new complex number. | |
| std_cIsZero (c) | |
| Check if a complex number is 0. | |
| std_cLog (c) | |
| The natural logarithm (base 'e') of a complex number. | |
| std_cLogNew (c) | |
| Returns the first solution of the natural logarithm (base 'e') of a complex number. The return is a new complex number. | |
| std_cMod (c) | |
| Get the modulus (phasis) of a complex number. | |
| std_cMul (c1, c2) | |
| Multiply two complex numbers. | |
| std_cMulNew (c1, c2) | |
| Multiply two complex numbers. The return is a new complex number. | |
| std_cNew (fReal, fImg) | |
| Create a new Complex. | |
| std_cPow (c, i) | |
| The power of a complex number by an integer. | |
| std_cPowNew (c, i) | |
| The power of a complex number by an integer The return is a new complex number. | |
| std_cRootn (c, i) | |
| Returns the first solution of the n-th root of a complex number. | |
| std_cRootnAll (c, i) | |
| Returns all n-th roots of a complex number. | |
| std_cRootnK (c, i, k) | |
| Returns a particular soultion of the n-th root of a complex number. | |
| std_cRootnNew (c, i) | |
| Returns the first solution of the n-th root of a complex number. The return is a new complex number. | |
| std_cSet (c, fReal, fImg) | |
| Set a complex number. | |
| std_cSetImg (c, fImg) | |
| Set the imaginary part of a complex number. | |
| std_cSetReal (c, fReal) | |
| Set the real part of a complex number. | |
| std_cSqr (c) | |
| The square of a complex number. | |
| std_cSqrNew (c) | |
| Square of a complex number. The return is a new complex number. | |
| std_cSqrt (c) | |
| Square root of a complex number. | |
| std_cSqrtNew (c) | |
| Square root of a complex number. The return is two new complex numbers. | |
| std_cSub (c1, c2) | |
| Substract two complex numbers. | |
| std_cSubNew (c1, c2) | |
| Substract two complex numbers. The return is a new complex number. | |
| std_cToS (c) | |
| Get a complex number to a literal string (like "a+bi") | |
| std_cZero () | |
| Create a new zero (0) Complex (0+0i) | |
Detailed Description
Package to load : lib/std/complex.pkg
Dependancies :
- none
Function Documentation
| std_cNew | ( | fReal | , |
| fImg | |||
| ) |
| std_cFromS | ( | szC | ) |
| std_cZero | ( | ) |
| std_cIsZero | ( | c | ) |
| std_cSetReal | ( | c | , |
| fReal | |||
| ) |
| std_cSetImg | ( | c | , |
| fImg | |||
| ) |
| std_cSet | ( | c | , |
| fReal | , | ||
| fImg | |||
| ) |
| std_cGetReal | ( | c | ) |
| std_cGetImg | ( | c | ) |
| std_cGet | ( | c | ) |
| std_cToS | ( | c | ) |
| std_cConjugate | ( | c | ) |
| std_cMod | ( | c | ) |
| std_cArg | ( | c | , |
| flag | |||
| ) |
Get the argument of a complex number.
The argument (or phasis) of (a+bi) is arctangent of b and a.
Prototype: fun [Complex I] F
- Parameters
-
Complex : a complex number. I : a flag. In the case where a and b are equals at 0 (zero), this function returns 0 if this flag is 0 or nil if this flag has another value. Indeed, in mathematics, this value is undefined but the many language, like C, returns 0 instead of a 'NaN' (Not a Number).
- Returns
- F : its argument, in radians (see above)
| std_cAdd | ( | c1 | , |
| c2 | |||
| ) |
Add two complex numbers.
Prototype: fun [Complex Complex] [F F]
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cAddNew
| std_cAddNew | ( | c1 | , |
| c2 | |||
| ) |
| std_cSub | ( | c1 | , |
| c2 | |||
| ) |
Substract two complex numbers.
Prototype: fun [Complex Complex] [F F]
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cSubNew
| std_cSubNew | ( | c1 | , |
| c2 | |||
| ) |
| std_cMul | ( | c1 | , |
| c2 | |||
| ) |
Multiply two complex numbers.
Prototype: fun [Complex Complex] [F F]
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cMulNew
| std_cMulNew | ( | c1 | , |
| c2 | |||
| ) |
| std_cDiv | ( | c1 | , |
| c2 | |||
| ) |
Divide two complex numbers.
Prototype: fun [Complex Complex] [F F]
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cDivNew
| std_cDivNew | ( | c1 | , |
| c2 | |||
| ) |
| std_cInv | ( | c | ) |
Returns the inverse of a complex number.
Prototype: fun [Complex] [F F]
- Parameters
-
Complex : a complex number.
- Returns
- [F F] : the result (real part and imaginary part), nil if error
- See Also
- std_cInvNew
- std_cPow (n = -1)
| std_cInvNew | ( | c | ) |
| std_cSqr | ( | c | ) |
The square of a complex number.
Prototype: fun [Complex] [F F]
- Parameters
-
Complex : a complex number.
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cSqrNew
| std_cSqrNew | ( | c | ) |
| std_cSqrt | ( | c | ) |
Square root of a complex number.
Prototype: fun [Complex] [[F F] [F F]]
- Parameters
-
Complex : a complex number.
- Returns
- [[F F] [F F]] : the result (two complex numbers with their real part and imaginary part)
- See Also
- std_cSqrtNew
| std_cSqrtNew | ( | c | ) |
| std_cPow | ( | c | , |
| i | |||
| ) |
The power of a complex number by an integer.
Prototype: fun [Complex I] [F F]
- Parameters
-
Complex : a complex number. I : an integer
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cPowNew
| std_cPowNew | ( | c | , |
| i | |||
| ) |
| std_cRootn | ( | c | , |
| i | |||
| ) |
Returns the first solution of the n-th root of a complex number.
Prototype: fun [Complex I] [F F]
- Parameters
-
Complex : a complex number. I : an integer
- Returns
- [F F] : the simplier result (real part and imaginary part)
- Remarks
- In fact, the n-th root of a complex number is 'multi valued'.
- See Also
- std_cRootnNew
- std_cRootnK for a particular value
- std_cRootnAll for all values
| std_cRootnNew | ( | c | , |
| i | |||
| ) |
Returns the first solution of the n-th root of a complex number. The return is a new complex number.
Prototype: fun [Complex I] Complex
- Parameters
-
Complex : a complex number. I : an integer
- See Also
- std_cRootn
- std_cRootnK
- std_cRootnAll
| std_cRootnAll | ( | c | , |
| i | |||
| ) |
Returns all n-th roots of a complex number.
The part real is :
(the n-th root of modulus) * cosine ((the argument + 2*k*Pi) / n)
The imaginary part is :
(the n-th root of modulus) * sine ((the argument + 2*k*Pi) / n)
where 'k' is an integer, with k <= 0 < n.
Prototype: fun [Complex I] [[I F F] r1]
- Parameters
-
Complex : a complex number. I : an integer (the 'n_th')
- Returns
- [[I F F] r1] : a list of all values. The first item of each tuple is the indice 'k'. The size of the list is 'n'.
- See Also
- std_cRootn for 'k' = 0
- std_cRootnNew for 'k' = 0
- std_cRootnK for a given 'k'
| std_cRootnK | ( | c | , |
| i | , | ||
| k | |||
| ) |
Returns a particular soultion of the n-th root of a complex number.
Prototype: fun [Complex I I] [F F]
- Parameters
-
Complex : a complex number. I : an integer, the 'n'-th root I : k : a particular solution (see std_cRootnAll for more details) k must be positive or nul and strictly lower than n (else, nil is returned)
- Returns
- [F F] : the result (real part and imaginary part)
- See Also
- std_cRootnNew for 'k' = 0
- std_cRootn for 'k' = 0
- std_cRootnAll for all 'k'
| std_cLog | ( | c | ) |
The natural logarithm (base 'e') of a complex number.
Prototype: fun [Complex] [F F]
- Parameters
-
Complex : a complex number.
- Returns
- [F F] : the result (real part and imaginary part)
- Remarks
- Cosine and sine being periodic functions, the natural logarithm of a complex number is also periodic. So, only the simple value is returned here, i.E. when 'k' = 0. To obtain all values, it need to apply this formula :
the real part is : log of modulus the imaginary part is : the argument + 2*k*Pi
where 'k' is an integer (in Z set)
If you want a particular result, add '2kPi' to the returned imaginary part.
| std_cLogNew | ( | c | ) |
| std_cEuler | ( | f | ) |
Exponentiation by the Euler's formula : e power fi where i is the imaginary unit (i² = -1) and f is a real number (here, f is a floatting point number).
e power fi = cos f + i sin f
Prototype: fun [F] [F F]
- Parameters
-
F : a floating point number.
- Returns
- [F F] : the result (real part and imaginary part)
Generated on Sat Jan 31 2015 19:15:45 for Scol standard library package by
1.8.1.2

