. , , ,

,,,

- — ,

........................................................................................................... 2

1 ....................................................................................... 4

2 ................... 7

2.1 ............................................................................................ 7

2.2 ........................................................................................ 7

2.3 λ............................................................... 8

2.4 .................................................................................... 9

2.5 ................................................................... 10

3 - ......................... 12

4 ............................................... 18

5 ............................................................... 27

.................................................................................................... 29

.................................... 30


, . , .. m 1 n :

a11x1 + + a1n xn = b1 ;

a21x1 + + a2n xn = b2 ;

am1x1+ + amnxn = bm .

x1, , xn , , . 1 , . , , . , . . (1693) , , , , ( m = n) , . , , , , . , , , . , , , . , .. , XIX . . , .


1

, : , , , , .

1. :

.

:

.

:

.

A B:

.

A 3:

.

:

2. :

.

:

, A B.

:

, A B..

A B:

A .

.

A 5:

.

:

.


2

2.1

, . ,

(1)

(2)

.

.

2.2

, ,


. , :

+ = + ; ()

+ ( + ) = ( + ) + ; ()

+ = .

, , ; .

2.3 λ

= [ij] λ , λ. λ. (1) , :

,

, :

1) = ;

2) (λ + μ) = λ + μΑ;

3) λ( + ) = λΑ+ λ;

4) λ( μ) = (λμ);

5) + (-) = .

, ; μ, λ - ; .

2.4

, . , :

, ( 1, 2), , ij :

cij = ai1b1j + ai2b2j + + ainbnj = ∑ n α = 1 aiαbαj,

i = 1,2, , m; j = 1, 2, , k.

ij = i- j- .

= , .

, ..

≠ .

, :

1) () = (); ();

2) λ() = (λ) = (λ);

3) ( + ) = + . ().

, , ; λ - .

, 1 2, . , , .

2.5

, . .

.

.


3 -

- 1 7.

:

MATRIX1 ;

MATRIX2 ;

ROW1, R1 ;

ROW2, R2 ;

COL1, C1 ;

COL2, C2 ;

RES_MATRIX ;

OUTPUT_STREAM ;

I, J P .

1 MODUL1

2 MODUL2


3 - SUM_MATRIX

4 - SUBTR_MATRIX

5 - MULT_NUMBER

6 - MULT_MATRIX

7 - FLIP


4

;

(SETF ROW_COL 0)

(SETQ INPUT_STREAM (OPEN " D:\MATRIX.TXT" :DIRECTION :INPUT))

;

(SETQ ROW_COL1 (READ INPUT_STREAM))

;

(SETF MATRIX1 (READ INPUT_STREAM))

; ,

(SETQ LIST_NUM1 (READ INPUT_STREAM))

;

(SETQ ROW_COL2 (READ INPUT_STREAM))

;

(SETF MATRIX2 (READ INPUT_STREAM))

; ,

(SETQ LIST_NUM2 (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

; 1

(SETQ ROW1 (CAR ROW_COL1))

(SETQ COL1 (CADR ROW_COL1))

; 2

(SETQ ROW2 (CAR ROW_COL2))

(SETQ COL2 (CADR ROW_COL2))

;

(DEFUN SUM_MATRIX (MATR1 MATR2 R1 R2 C1 C2)

;

(DECLARE (SPECIAL RES_MATRIX))

; 1 2,

(IF (OR (/= R1 R2) (/= C1 C2)) '"It is not possible to calculate the sum of matrices"

(PROGN

(SETQ RES_MATRIX (MAKE-ARRAY (LIST R1 C1) :ELEMENT-TYPE 'INTEGER :INITIAL-ELEMENT 0))

(DO

((I 0))

((>= I R1))

(DO

((J 0))

((>= J C1))

(SETF (AREF RES_MATRIX I J) (+ (AREF MATR1 I J) (AREF MATR2 I J)))

(SETQ J (+ J 1))

)

(SETQ I (+ I 1))

)

RES_MATRIX

)

)

)

;

(DEFUN SUBTR_MATRIX (MATR1 MATR2 R1 R2 C1 C2)

;

(DECLARE (SPECIAL RES_MATRIX))

; 1 2,

(IF (OR (/= R1 R2) (/= C1 C2)) '"It is not possible to calculate the difference matrix"

(PROGN

(SETQ RES_MATRIX (MAKE-ARRAY (LIST R1 C1) :ELEMENT-TYPE 'INTEGER :INITIAL-ELEMENT 0))

(DO

((I 0))

((>= I R1))

(DO

((J 0))

((>= J C1))

(SETF (AREF RES_MATRIX I J) (- (AREF MATR1 I J) (AREF MATR2 I J)))

(SETQ J (+ J 1))

)

(SETQ I (+ I 1))

)

RES_MATRIX

)

)

)

; L

(DEFUN MULT_NUMBER (MATR ROW COL L)

(DECLARE (SPECIAL RES_MATRIX))

;

(SETQ RES_MATRIX (MAKE-ARRAY (LIST ROW COL) :ELEMENT-TYPE 'INTEGER :INITIAL-ELEMENT 0))

(DO

((I 0))

((>= I ROW))

(DO

((J 0))

((>= J COL))

(SETF (AREF RES_MATRIX I J) (* L (AREF MATR I J)))

(SETQ J (+ J 1))

)

(SETQ I (+ I 1))

)

RES_MATRIX

)

;

(DEFUN MULT_MATRIX (MATR1 MATR2 R1 R2 C1 C2)

(DECLARE (SPECIAL TEMP))

(DECLARE (SPECIAL RES_MATRIX))

(SETQ TEMP 0)

(IF (/= C1 R2) '"It is not possible to calculate products of matrices"

(PROGN

;

(SETQ RES_MATRIX (MAKE-ARRAY (LIST R1 C2) :ELEMENT-TYPE 'INTEGER :INITIAL-ELEMENT 0))

(DO

((I 0))

((>= I R1))

(DO

((J 0))

((>= J C2))

(SETQ TEMP 0)

(DO

((P 0))

((>= P C1))

(SETQ TEMP (+ TEMP (* (AREF MATR1 I P) (AREF MATR2 P J))))

(SETQ P (+ P 1))

)

(SETF (AREF RES_MATRIX I J) TEMP)

(SETQ J (+ J 1))

)

(SETQ I (+ I 1))

)

RES_MATRIX

)

)

)

;

(DEFUN FLIP (MATR ROW COL)

(DECLARE (SPECIAL RES_MATRIX))

;

(IF (/= ROW COL) '"It is not possible to flip matrice"

(PROGN

;

(SETQ RES_MATRIX (MAKE-ARRAY (LIST COL ROW) :ELEMENT-TYPE 'INTEGER :INITIAL-ELEMENT 0))

(DO

((I 0))

((>= I ROW))

(DO

((J 0))

((>= J COL))

(SETF (AREF RES_MATRIX I J) (AREF MATR J I))

(SETQ J (+ J 1))

)

(SETQ I (+ I 1))

)

RES_MATRIX

)

)

)

; " "

(DEFUN MULT1 (NUM)

(PRINT (MULT_NUMBER MATRIX1 ROW1 COL1 NUM) OUTPUT_STREAM)

)

; " "

(DEFUN MULT2 (NUM)

(PRINT (MULT_NUMBER MATRIX2 ROW2 COL2 NUM) OUTPUT_STREAM)

)

;

(SETQ OUTPUT_STREAM (OPEN " D:\RESULT.TXT" :DIRECTION :OUTPUT))

; 1

(PRINT (LIST 'MATRIX_1 MATRIX1) OUTPUT_STREAM)

; 2

(PRINT (LIST 'MATRIX_2 MATRIX2) OUTPUT_STREAM)

(PRINT '---------------------------- OUTPUT_STREAM)

;

(PRINT (LIST 'SUM_MATRIX (SUM_MATRIX MATRIX1 MATRIX2 ROW1 ROW2 COL1 COL2)) OUTPUT_STREAM)

;

(PRINT (LIST 'DIFFERENCE_MATRIX (SUBTR_MATRIX MATRIX1 MATRIX2 ROW1 ROW2 COL1 COL2)) OUTPUT_STREAM)

;

(PRINT (LIST 'MULTIPLICATION_MATRIX (MULT_MATRIX MATRIX1 MATRIX2 ROW1 ROW2 COL1 COL2)) OUTPUT_STREAM)

(PRINT '---------------------------- OUTPUT_STREAM)

; 1

(PRINT (LIST 'FLIP_MATRIX1 (FLIP MATRIX1 ROW1 COL1)) OUTPUT_STREAM)

; 2

(PRINT (LIST 'FLIP_MATRIX2 (FLIP MATRIX2 ROW2 COL2)) OUTPUT_STREAM)

(PRINT '---------------------------- OUTPUT_STREAM)

; 1

(PRINT 'MULTIPLICATION_MATRIX_ON_NUMBER OUTPUT_STREAM)

(PRINT (LIST 'NUMBERS LIST_NUM1) OUTPUT_STREAM)

(PRINT 'MATRIX1 OUTPUT_STREAM)

(MAPCAR 'MULT1 LIST_NUM1)

(PRINT '---------------------------- OUTPUT_STREAM)

; 2

(PRINT (LIST 'NUMBERS LIST_NUM2) OUTPUT_STREAM)

(PRINT 'MATRIX2 OUTPUT_STREAM)

(MAPCAR 'MULT2 LIST_NUM2)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)


5

1.

8

9

2.

10


11


. , . , . , : , , , , , .

. . .


1.         , .. ( ). [ ] / ... .: , 2002, . 218.

2.         , .. . [] / . , ... .: , 1999. . 342.

3.         , .. . [ ] / ... .: , 2001. . 504.

4.         , .. . [] / ... .: , 2004. .310.

5.         , .. Lisp. [ ] / .., ... .: , 2003. . 79.

........................................................................................................... 2 1 ....................................................................................... 4

 

 

 

! , , , .
. , :