Matrix-exponentiation operator: Difference between revisions
Content deleted Content added
adding lambdatalk |
With Numeric.LinearAlgebra |
||
Line 1,525: | Line 1,525: | ||
Note: this implementation does not work for a power of 0. |
Note: this implementation does not work for a power of 0. |
||
===With Numeric.LinearAlgebra=== |
|||
<lang haskell>import Numeric.LinearAlgebra |
|||
a :: Matrix I |
|||
a = (2><2) |
|||
[1,2 |
|||
,0,1] |
|||
main = do |
|||
print $ a^4 |
|||
putStrLn "power of zero: " |
|||
print $ a^0</lang> |
|||
{{Out}} |
|||
<pre> |
|||
(2><2) |
|||
[ 1, 16 |
|||
, 0, 1 ] |
|||
power of zero: |
|||
(1><1) |
|||
[ 1 ]</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |