Matrix-exponentiation operator: Difference between revisions

Add Jsish
(Add Jsish)
Line 1,425:
user 0m0.625s
sys 0m0.006s</lang>
 
=={{header|Jsish}}==
Based on Javascript matrix entries.
 
Uses module listed in [[Matrix Transpose#Jsish]]. Fails the task spec actually, as Matrix.exp() is implemented as a method, not an operator.
 
<lang javascript>/* Matrix exponentiation, in Jsish */
require('Matrix');
 
if (Interp.conf('unitTest')) {
var m = new Matrix([[3, 2], [2, 1]]);
; m;
; m.exp(0);
; m.exp(1);
; m.exp(2);
; m.exp(4);
; m.exp(10);
}
 
/*
=!EXPECTSTART!=
m ==> { height:2, mtx:[ [ 3, 2 ], [ 2, 1 ] ], width:2 }
m.exp(0) ==> { height:2, mtx:[ [ 1, 0 ], [ 0, 1 ] ], width:2 }
m.exp(1) ==> { height:2, mtx:[ [ 3, 2 ], [ 2, 1 ] ], width:2 }
m.exp(2) ==> { height:2, mtx:[ [ 13, 8 ], [ 8, 5 ] ], width:2 }
m.exp(4) ==> { height:2, mtx:[ [ 233, 144 ], [ 144, 89 ] ], width:2 }
m.exp(10) ==> { height:2, mtx:[ [ 1346269, 832040 ], [ 832040, 514229 ] ], width:2 }
=!EXPECTEND!=
*/</lang>
 
{{out}}
<pre>prompt$ jsish -u matrixExponentiation.jsi
[PASS] matrixExponentiation.jsi</pre>
 
=={{header|Julia}}==
Anonymous user