Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4pD5LRLNWAecBNsj9
31 lines
634 B
Plaintext
31 lines
634 B
Plaintext
Addition and multiplication
|
|
===========================
|
|
|
|
A + B (both 2x3)
|
|
[1 2 3]
|
|
[4 5 6]
|
|
+
|
|
[6 5 4]
|
|
[3 2 1]
|
|
=
|
|
[7 7 7]
|
|
[7 7 7]
|
|
|
|
X * Y (2x3 times 3x2 gives 2x2)
|
|
[1 2 3]
|
|
[4 5 6]
|
|
*
|
|
[ 7 8]
|
|
[ 9 10]
|
|
[11 12]
|
|
=
|
|
[ 58 64]
|
|
[139 154]
|
|
|
|
multiply (i-j-k) and multiplyIkj agree: true
|
|
X * I (3x3 identity) equals X: true
|
|
|
|
add 2x3 + 3x2 -> IllegalArgumentException: cannot add 2x3 and 3x2: both matrices must have the same shape
|
|
multiply 2x3 * 2x3 -> IllegalArgumentException: cannot multiply 2x3 by 2x3: columns of A (3) must equal rows of B (2)
|
|
add with a jagged row -> IllegalArgumentException: row 1 has 1 columns but row 0 has 2
|