|
160 | 160 | | 0 | 0 | 0 | 3 | |
161 | 161 | + Composing homomorphisms (here LinTran) |
162 | 162 | + Typing: let A, B, C be vector spaces and hᵢ linear transformations |
| 163 | +#+BEGIN_SRC text |
163 | 164 | h₂ h₁ |
164 | 165 | C <———— B <———— A |
165 | 166 | h₂∘h₁ |
166 | 167 | C <———————————— A |
167 | | - |
| 168 | +#+END_SRC |
168 | 169 | + Property: "homomorphisms compose" |
| 170 | +#+BEGIN_SRC text |
169 | 171 | LinTran(h₁, A,B) ∧ |
170 | 172 | LinTran(h₂, B,C) ⇒ |
171 | 173 | LinTran(h₂∘h₁,A, C) |
| 174 | +#+END_SRC |
172 | 175 | + Composing LinTran (towards matrix multiplication) |
173 | 176 | + Typing + specification: let hᵢ = evalMV Mᵢ |
174 | 177 | #+BEGIN_SRC text |
|
181 | 184 | mulM M₂ M₁ |
182 | 185 | #+END_SRC |
183 | 186 | + Property? (three variants) |
184 | | - ∃ mulM . evalMV (mulM M₂ M₁) = evalMV M₂ ∘ evalMV M₁ |
185 | | - "can we compute a matrix for the composition h₂ ∘ h₁ from just M₂ and M₁?" |
186 | | - ∃ mulM . H2(evalMV, mulM, (∘)) |
| 187 | + + ∃ mulM . evalMV (mulM M₂ M₁) = evalMV M₂ ∘ evalMV M₁ |
| 188 | + + "can we compute a matrix for the composition h₂ ∘ h₁ from just M₂ and M₁?" |
| 189 | + + ∃ mulM . H2(evalMV, mulM, (∘)) |
187 | 190 | + Example: |
188 | 191 | #+BEGIN_SRC text |
189 | 192 | A = a->REAL; B=b->REAL; C=c->REAL |
|
263 | 266 | mulM m₂ m₁ |
264 | 267 | #+END_SRC |
265 | 268 | where we know |
| 269 | +#+BEGIN_SRC haskell |
266 | 270 | h₁ = evalMV m₁; |
267 | 271 | h₂ = evalMV m₂; |
| 272 | +#+END_SRC |
268 | 273 |
|
269 | 274 | Start computing (towards a definition of mulM): |
| 275 | +#+BEGIN_SRC haskell |
270 | 276 | getCol (mulM m₂ m₁) i |
271 | 277 | = -- Specification of (mulM m₂ m₁) |
272 | 278 | (h₂ ∘ h₁) eᵢ |
|
276 | 282 | evalMV m₂ (getCol m₁ i) |
277 | 283 | = -- Def. of (∘) |
278 | 284 | (evalMV m₂ ∘ getCol m₁) i |
| 285 | +#+END_SRC |
279 | 286 | Thus we have |
| 287 | +#+BEGIN_SRC haskell |
280 | 288 | getCol (mulM m₂ m₁) == evalMV m₂ ∘ getCol m₁ |
| 289 | +#+END_SRC |
281 | 290 | and we can apply flip to both sides (as before) |
| 291 | +#+BEGIN_SRC haskell |
282 | 292 | flip (getCol (mulM m₂ m₁)) == flip (evalMV m₂ ∘ getCol m₁) |
| 293 | +#+END_SRC |
283 | 294 | we notice getCol = flip and flip ∘ flip = id |
| 295 | +#+BEGIN_SRC haskell |
284 | 296 | mulM m₂ m₁ == flip (evalMV m₂ ∘ getCol m₁) |
| 297 | +#+END_SRC |
285 | 298 | This is now a definition of mulM which satisfies its specification. |
286 | 299 | (Reminder: evalMV m v = linComb v m = Σᵢ scale vᵢ mᵢ) |
287 | 300 | + Summing up: |
| 301 | +#+BEGIN_SRC haskell |
288 | 302 | type A = Vec s a |
289 | 303 | type B = Vec s b |
290 | 304 | type C = Vec s c |
|
293 | 307 | mulM m₂ m₁ == flip (evalMV m₂ ∘ getCol m₁) |
294 | 308 |
|
295 | 309 | evalMV = mulMV : Mat s a b -> Vec s a -> Vec s b |
| 310 | +#+END_SRC |
296 | 311 | + Perhaps some live-coding [[Live_7_1_2023.hs]] |
297 | 312 |
|
298 | 313 | ** Lecture 7.2 / 8.1: Laplace Transforms |
|
0 commit comments