Cramer's rule: Difference between revisions

m (→‎{{header|Raku}}: some sigil-less, other changes for code-readability)
Line 2,606:
</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
===Explicit Cramer's rule===
≪ '''IF''' OVER DET
'''THEN'''
LAST ROT DUP SIZE 1 GET → vect det mtx dim
≪ 1 dim '''FOR''' c
mtx
1 dim '''FOR''' r
r c 2 →LIST vect r GET PUT
'''NEXT'''
DET det /
'''NEXT'''
dim →ARRY
'''END'''
‘CRAMR’ STO
 
[[ 2 -1 5 1 ][ 3 2 2 -6 ][ 1 3 3 -1 ][ 5 -2 -3 3 ]]
[ -3 -32 -47 49 ] CRAMR
{{out}}
<pre>
1: [ 2 -12 -4 1 ]
</pre>
 
===Implicit Cramer's rule===
RPL use Cramer's rule for its built-in equation system resolution feature, performed by the <code>/</code> instruction.
[ -3 -32 -47 49 ]
[[ 2 -1 5 1 ][ 3 2 2 -6 ][ 1 3 3 -1 ][ 5 -2 -3 3 ]]
/
{{out}}
<pre>
1: [ 2 -12 -4 1 ]
</pre>
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">require 'matrix'
1,150

edits