Cramer's rule: Difference between revisions
Content added Content deleted
(→{{header|jq}}: fix bug) |
|||
Line 1,767: | Line 1,767: | ||
| (a | det) as $ad |
| (a | det) as $ad |
||
| if $ad == 0 then "matrix determinant is 0" | error |
| if $ad == 0 then "matrix determinant is 0" | error |
||
else reduce range(0; $n) as $c (null; |
|||
(reduce range(0; $n) as $r (a; .[$r][$c] = d[$r])) as $aa |
(reduce range(0; $n) as $r (a; .[$r][$c] = d[$r])) as $aa |
||
| .[$c] = ($aa|det) / $ad ) |
| .[$c] = ($aa|det) / $ad ) |
||
end ; |
|||
def a: [ |
def a: [ |
||
Line 1,786: | Line 1,787: | ||
Solution is [2,-12,-4,1] |
Solution is [2,-12,-4,1] |
||
</pre> |
</pre> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
{{works with|Julia|0.6}} |
{{works with|Julia|0.6}} |