8.0.0.1. complex: Complex Numbers Library
(packages/libnum/libcomplex.lsh)


This is a library of functions on complex numbers. a complex number, as manipulated by these functions, is simply represented as an idx1 of double with 2 elements. Creating a complex literal can be done with (setq z [3 4]) , just like with vectors literal. Allocating an empty complex is done with (setq z (new-complex)) , which is equivalent to (setq z (double-matrix 2)) .

8.0.0.1.0. (new-complex)
(packages/libnum/libcomplex.lsh)


returns a new complex (i.e. an idx1 of double of size 2).

8.0.0.1.1. (complex-matrix [s0 [s1 ...sn]])
(packages/libnum/libcomplex.lsh)


returns a new complex matrix of size s0 , s1 ,... sn . A complex matrix is nothing more than a double matrix with an extra dimension of size two. In other words, (complex-matrix) returns a double matrix of size 2 (equivalent to (double-matrix 2) and to (new-complex) . Similarly, (complex-matrix 3 3 4) returns a double matrix of size 3x3x4x2, and so on.

8.0.0.1.2. Complex functions that return a real
(packages/libnum/libcomplex.lsh)




8.0.0.1.2.0. (carg z)
[DX] (packages/libnum/libcomplex.lsh)


argument of z (returns angle between -pi and pi).

8.0.0.1.2.1. (cabs z)
[DX] (packages/libnum/libcomplex.lsh)


magnitude/modulus of z

8.0.0.1.2.2. (cabs2 z)
(packages/libnum/libcomplex.lsh)


sqaure magnitude/square modulus of z

8.0.0.1.2.3. (clogabsz)
(packages/libnum/libcomplex.lsh)


logarithm of magnitude of z .

8.0.0.1.3. Dyadic Complex Operators
(packages/libnum/libcomplex.lsh)


these functions allocate and return a complex result. example:
? (c* [1 2] [3 5])
= [-7.00 11.00 ]


8.0.0.1.3.0. (c+ a b)
(packages/libnum/libcomplex.lsh)


addition

8.0.0.1.3.1. (c- a b)
(packages/libnum/libcomplex.lsh)


subtraction

8.0.0.1.3.2. (c* a b)
(packages/libnum/libcomplex.lsh)


product

8.0.0.1.3.3. (c/ a b)
(packages/libnum/libcomplex.lsh)


division

8.0.0.1.3.4. (c** a b)
(packages/libnum/libcomplex.lsh)


power

8.0.0.1.3.5. (clogb a b)
(packages/libnum/libcomplex.lsh)


compute log( a )/log( b ), logarithms of a in complex base b .

8.0.0.1.4. Unary Complex Operators
(packages/libnum/libcomplex.lsh)


complex functions that return a complex. example:
 ? (csqrt [0 2])
 = [ 1.00  1.00 ]


8.0.0.1.4.0. (cconjugate z)
(packages/libnum/libcomplex.lsh)


complex conjugate

8.0.0.1.4.1. (cinverse z)
(packages/libnum/libcomplex.lsh)


complex inverse

8.0.0.1.4.2. (cnegative z)
(packages/libnum/libcomplex.lsh)


negative

8.0.0.1.4.3. (csqrt z)
(packages/libnum/libcomplex.lsh)


square root

8.0.0.1.4.4. (cexp z)
(packages/libnum/libcomplex.lsh)


exponential

8.0.0.1.4.5. (clog z)
(packages/libnum/libcomplex.lsh)


log

8.0.0.1.4.6. (clog10 z)
(packages/libnum/libcomplex.lsh)


log base 10

8.0.0.1.4.7. (csin z)
(packages/libnum/libcomplex.lsh)


sine

8.0.0.1.4.8. (ccos z)
(packages/libnum/libcomplex.lsh)


cosine

8.0.0.1.4.9. (ctan z)
(packages/libnum/libcomplex.lsh)


tangent

8.0.0.1.4.10. (csec z)
(packages/libnum/libcomplex.lsh)


secant

8.0.0.1.4.11. (ccsc z)
(packages/libnum/libcomplex.lsh)


cosecant

8.0.0.1.4.12. (ccot z)
(packages/libnum/libcomplex.lsh)


cotangent

8.0.0.1.4.13. (carcsin z)
(packages/libnum/libcomplex.lsh)


arcsine

8.0.0.1.4.14. (carccos z)
(packages/libnum/libcomplex.lsh)


arccosine

8.0.0.1.4.15. (carctan z)
(packages/libnum/libcomplex.lsh)


arctangent

8.0.0.1.4.16. (csinh z)
(packages/libnum/libcomplex.lsh)


hyperbolic sine

8.0.0.1.4.17. (ccosh z)
(packages/libnum/libcomplex.lsh)


hyperbolic scosine

8.0.0.1.4.18. (ctanh z)
(packages/libnum/libcomplex.lsh)


hyperbolic tangent

8.0.0.1.4.19. (csech z)
(packages/libnum/libcomplex.lsh)


hyperbolic secant

8.0.0.1.4.20. (ccsch z)
(packages/libnum/libcomplex.lsh)


hyperbolic cosecant

8.0.0.1.4.21. (ccoth z)
(packages/libnum/libcomplex.lsh)


hyperbolic cotangent

8.0.0.1.4.22. (carcsinh z)
(packages/libnum/libcomplex.lsh)


hyperbolic arcsine

8.0.0.1.4.23. (carccosh z)
(packages/libnum/libcomplex.lsh)


hyperbolic arccos

8.0.0.1.4.24. (carctanh z)
(packages/libnum/libcomplex.lsh)


hyperbolic arctangent

8.0.0.1.4.25. (carcsech z)
(packages/libnum/libcomplex.lsh)


hyperbolic arcsecant