# Khan/khan-exercises

Older
100644 163 lines (149 sloc) 6.32 KB
 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 1 007e23e Switch from KhanUtil.matrix* to kmatrix Jack Toole authored Oct 29, 2013 2 cde9e9f Re-run the exercises through the updated cleaner. jeresig authored Apr 24, 2013 3 0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 4 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 5 Multiplying a matrix by a vector ac1415e Use requirejs for module loading spicyj authored Mar 5, 2014 6 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 7 8 9
10 11
12 DIM_2 13 1 14 makeMatrix(randRange(-2, 5, DIM_1, DIM_2)) 15 makeMatrix(randRange(-2, 5, DIM_3, DIM_4)) 16 17 18 matrixMult(MAT_1, MAT_2) 19 8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 17, 2012 20 matrixPad(SOLN_MAT, 3, 3) 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 21 22 "\\textbf " + randFromArray("ABCDEF") 23 "\\textbf " + randFromArray("vw") 24 25 26 [GREEN, BLUE, GRAY] 27 [ORANGE] 28 29 30 makeMultHintMatrix(MAT_1, MAT_2, ROW_COLORS, COL_COLORS) 31 32 bd4e680 Change from $._ and$.ngettext over to i18n._ and i18n.ngettext. csilvers authored Oct 22, 2015 33 i18n._("row") 34 i18n._("column") 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 35
36 37
38

8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 18, 2012 39 PRETTY_MAT_1_ID = printSimpleMatrix(MAT_1) 40

41

42 PRETTY_MAT_2_ID = printSimpleMatrix(MAT_2) 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 43

44
45 46

47 What is PRETTY_MAT_1_ID + PRETTY_MAT_2_ID? 48

49 50
51
52

53 Because PRETTY_MAT_1_ID has dimensions (DIM_1 + "\\times" + DIM_2) and PRETTY_MAT_2_ID has dimensions (DIM_3 + "\\times" + DIM_4), the answer matrix will have dimensions (DIM_1 + "\\times" + DIM_4). 54

55

56 57 PRETTY_MAT_1_ID + PRETTY_MAT_2_ID 58 = 59 printColoredDimMatrix(MAT_1, ROW_COLORS, true) 60 printColoredDimMatrix(MAT_2, COL_COLORS, false) 61 = 62 63 printSimpleMatrix(maskMatrix(FINAL_HINT_MAT, [])) 64 65 66

67
68
69

70 To find the element at any row i, column j of the answer matrix, multiply the elements in row i of the first matrix, PRETTY_MAT_1_ID, with the corresponding elements in column j of the second matrix, PRETTY_MAT_2_ID, and add the products together. 71

72
73
74

cee8be0 Don't use $._ inside of s xymostech authored Jun 11, 2013 75 So, to find the element at row 1, column 1 of the answer matrix, multiply the first element in colorMarkup("\\text{" + ROW + " }1", ROW_COLORS[0]) of PRETTY_MAT_1_ID with the first element in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID, then multiply the second element in colorMarkup("\\text{" + ROW + " }1", ROW_COLORS[0]) of PRETTY_MAT_1_ID with the second element in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID, and so on. Add the products together. 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 76 77 78 79 80 printSimpleMatrix( 81 maskMatrix(FINAL_HINT_MAT, [[1, 1]]) 82 ) 83 84 85 86 87 88 cee8be0 Don't use$._ inside of s xymostech authored Jun 12, 2013 89 Likewise, to find the element at row 2, column 1 of the answer matrix, multiply the elements in colorMarkup("\\text{" + ROW + " }2", ROW_COLORS[1]) of PRETTY_MAT_1_ID with the corresponding elements in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID and add the products together. 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 90

91

92 93 94 printSimpleMatrix( 95 maskMatrix(FINAL_HINT_MAT, [[1, 1], [2, 1]]) 96 ) 97 98 99

100
101
102

103 Fill out the rest: 104

105

106 107 108 printSimpleMatrix(FINAL_HINT_MAT) 109 110 111

112
113
114

After simplifying, we end up with:

115
116 117 printSimpleMatrix(SOLN_MAT) 118 119
120
121
122 0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 123
124
8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 18, 2012 125 0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 126 8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 18, 2012 127 elem 128 0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 129 8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 18, 2012 130 elem 131 9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 132 8fc85e7 Add exercises: Finding the determinant of a matrix, finding the inver… Stephanie H. Chang authored Nov 18, 2012 133
9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 134
135 136
137 138 139
0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 140
9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 141 2 142 2 143
144
145
0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 146
9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 147 2 148 3 149
150
151 152 153
0f0c630 Clean up the exercise files using the new cleaning utility. (II) cbhl authored Apr 16, 2013 154
9454903 Add exercises: Multiplying a matrix with a vector, multiplying a matr… Stephanie H. Chang authored Oct 22, 2012 155 3 156 2 157
158
159
160
cde9e9f Re-run the exercises through the updated cleaner. jeresig authored Apr 24, 2013 161 162