Matrix-exponentiation operator: Difference between revisions
Content deleted Content added
Added Wren |
adding lambdatalk |
||
Line 1,833:
[832040.0, 514229.0]
</pre>
=={{header|Lambdatalk}}==
<lang scheme>
{require lib_matrix}
{def M.exp
{lambda {:m :n}
{if {= :n 0}
then {M.new [ [1,0],[0,1] ]}
else {S.reduce M.multiply {S.map {{lambda {:m _} :m} :m} {S.serie 1 :n}}}}}}
-> M.exp
'{def M
{M.new [[3,2],
[2,1]]}}
-> M
{S.map {lambda {:i} {br}M{sup :i} = {M.exp {M} :i}}
0 1 2 3 4 10}
->
M^0 = [[1,0],[0,1]]
M^1 = [[3,2],[2,1]]
M^2 = [[13,8],[8,5]]
M^3 = [[55,34],[34,21]]
M^4 = [[233,144],[144,89]]
M^10 = [[1346269,832040],[832040,514229]]
</lang>
=={{header|Liberty BASIC}}==
|