Question: Write a function matrix-multiply that takes two matrices as input and multiplies them and outputs the resultant in LISP. It should be recursive. testing: (MATRIX-MULTIPLY
Write a function matrix-multiply that takes two matrices as input and multiplies them and outputs the resultant in LISP. It should be recursive.
testing: (MATRIX-MULTIPLY 'NIL 'NIL) value: NIL
testing: (MATRIX-MULTIPLY '((1 2) (2 1)) '((3 1) (1 3))) value: ((5 7) (7 5))
testing: (MATRIX-MULTIPLY '((1 2) (2 1)) '((5 6 7) (8 9 10))) value: ((21 24 27) (18 21 24))
testing: (MATRIX-MULTIPLY '((1 -2) (2 -1)) '((5 -6 7) (-8 9 -10))) value: ((21 -24 27) (18 -21 24))
testing: (MATRIX-MULTIPLY '((1 0) (-1 1)) '((0 1 1) (0 1 0))) value: ((0 1 1) (0 0 -1))
testing: (MATRIX-MULTIPLY '((0 0) (0 0)) '((0 0 0) (0 0 0))) value: ((0 0 0) (0 0 0))
testing: (MATRIX-MULTIPLY '((1 2) (2 1)) '((5 6 7 8) (9 10 11 12))) value: ((23 26 29 32) (19 22 25 28))
testing: (MATRIX-MULTIPLY '((1 0 1 9)) '((9) (8) (7) (6))) value: ((70))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
