(defun [V
] ( [E
] mat
/ detmc trp cxc c
-c c_ c
/c A
-[E
]I matn v matn
-1 det detx x k kk kkk n nn
)
;;;***********************************************************************************;;;
;;; (detmc m) function calculates determinant of square martix ;;;
;;; this version includes complex numbers ;;;
;;; Marko Ribar, d.i.a. ;;;
;;; Args: m - nxn matrix of complex numbers ;;;
;;; (detmc '(((0 0) (1 0)) ((1 0) (0 0)))) ;;;
;;; (detmc '(((1.4 0) (2.1 0) (5.4 0) (6.5 0)) ((4.1 0) (9.3 0) (4.5 0) (8.5 0)) ((1.2 0) (4.1 0) (6.2 0) (7.5 0)) ((4.7 0) (8.5 0) (9.3 0) (0.1 0)))) ;;;
;;;***********************************************************************************;;;
;;; Command: (detmc '(((1.2 1.0) (2.4 1.3) (0.5 0.6)) ((1.3 1.25) (1.5 2.0) (0.8 -1.4)) ((-2.3 -1.4) (0.6 -0.6) (-0.3 -0.3))))
;;; (-15.3785 7.4325)
;;; det = (1.2 + 1.0i)(1.5 + 2.0i)(-0.3 - 0.3i)+(2.4 + 1.3i)(0.8 - 1.4i)(-2.3 - 1.4i)+(0.5 + 0.6i)(1.3 + 1.25i)(0.6 - 0.6i)-(-2.3 - 1.4i)(1.5 + 2.0i)(0.5 + 0.6i)-(0.6 - 0.6i)(0.8 - 1.4i)(1.2 + 1.0i)-(-0.3 - 0.3i)(1.3 + 1.25i)(2.4 + 1.3i)
;;; det = (1.8 + 2.4i + 1.5i - 2)(-0.3 - 0.3i)+(1.92 - 3.36i + 1.04i + 1.82)(-2.3 - 1.4i)+(0.65 + 0.625i + 0.78i - 0.75)(0.6 - 0.6i)-(-3.45 - 4.6i - 2.1i + 2.8)(0.5 + 0.6i)-(0.48 - 0.84i - 0.48i - 0.84)(1.2 + 1.0i)-(-0.39 - 0.375i - 0.39i + 0.375)(2.4 + 1.3i)
;;; det = (-0.2 + 3.9i)(-0.3 - 0.3i)+(3.74 - 2.32i)(-2.3 - 1.4i)+(-0.1 + 1.405i)(0.6 - 0.6i)-(-0.65 - 6.7i)(0.5 + 0.6i)-(-0.36 - 1.32i)(1.2 + 1.0i)-(-0.015 - 0.765i)(2.4 + 1.3i)
;;; det = 0.06 + 0.06i - 1.17i + 1.17 - 8.602 - 5.236i + 5.336i - 3.248 - 0.06 + 0.06i + 0.843i + 0.843 + 0.325 + 0.39i + 3.35i - 4.02 + 0.432 + 0.36i + 1.584i - 1.32 + 0.036 + 0.0195i + 1.836i - 0.9945
;;; det = -15.3785 + 7.4325i
(defun detmc
( m
/ d cxc det
)
)
)
)
(defun cxc
( c1 c2
/ a1 a2 b1 b2 r i
) (setq r
(- (* a1 a2
) (* b1 b2
))) (setq i
(+ (* a1 b2
) (* a2 b1
))) )
)
r
)
q
)
)
(det m)
)
)
(defun cxc
( c1 c2
/ a1 a2 b1 b2 r i
) (setq r
(- (* a1 a2
) (* b1 b2
))) (setq i
(+ (* a1 b2
) (* a2 b1
))) )
)
;; Complex Conjugate - Lee Mac
;; Args: c1 - complex number of the form a+bi = (a b)
)
;; Complex Division - Lee Mac
;; Args: c1,c2 - complex numbers of the form a+bi = (a b)
)
)
(defun A
-[E
]I
( [E
] mat
/ k rown n matn
) )
)
(setq matn
(A
-[E
]I
[E
] mat
)) ;;; matn * v = 0 [Determinant of matn = 0 => either trivial solution of v = ((0.0 0.0) (0.0 0.0) ... (0.0 0.0)) which is not required or infinetely more solutions - system of equations is not solvable for non 0.0 values, but for parametric values...]
;;; consider v = (x1 x2 x3 ... xn) and x1 = p + qi, then we have square matrix matn-1 (reduced first row and first column) with determinant /= 0.0 + 0.0i and corresponding augmented matrix with right column becomes x1 * v1(matn) with reduced first row and inverse signs
;;; for easier computation reasons we now consider p = 1.0 and q = 0.0, then right column of augmented matrix becomes v1(matn) with reduced first row and inverse signs...
;;; from this system we can calculate x2, x3, ... xn in terms of x1 = (1.0 + 0.0i) * t where t is parameter which can be any number
;;; so here we continue...
(setq det
(detmc matn
-1)) (setq det
(detmc matn
-1)) )
)
)
)
)
)
(prompt "\nFor all reduced square matrices (n-1 x n-1) determinant is equal to 0.0 + 0.0i, and because of this eigenvector for eigenvalue : ") (princ [E
]) (prompt " and matrix : ") (princ mat
) (prompt " is not possible to determine - trivial solution v = ((0.0 0.0) (0.0 0.0) ... (0.0 0.0)) is satisfactory, but not required for this task...") )
)
)