Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function matrix-multiply that takes two matrices as input and multiplies

ID: 3669438 • Letter: W

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 '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))

Explanation / Answer

non recursive:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote