March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -0,0 +1,2 @@
> M := <<1,2>|<3,4>>;
> M ^ 2;

View file

@ -0,0 +1,2 @@
> M := <<1,2>|<3,4>>;
> M ^~ 2;

View file

@ -0,0 +1,23 @@
(define (dec x)
(- x 1))
(define (halve x)
(/ x 2))
(define (row*col row col)
(apply + (map * row col)))
(define (matrix-multiply m1 m2)
(map
(lambda (row)
(apply map (lambda col (row*col row col))
m2))
m1))
(define (matrix-exp mat exp)
(cond ((= exp 1) mat)
((even? exp) (square-matrix (matrix-exp mat (halve exp))))
(else (matrix-multiply mat (matrix-exp mat (dec exp))))))
(define (square-matrix mat)
(matrix-multiply mat mat))