Cramer's rule: Difference between revisions
m
modified the task to solve for 4 unknown variables and updated the examples
m (→{{header|Perl 6}}: generic algorithm for matrix determinant) |
m (modified the task to solve for 4 unknown variables and updated the examples) |
||
Line 18:
:<math>
\begin{cases}
w+3x
5w-2x-3y+3z=49 \\
\end{cases}
</math>
solve for <math>w</math>, <math>x</math>, <math>y</math> and <math>z</math>, using Cramer's rule.
=={{header|Perl 6}}==
Line 58 ⟶ 59:
my @matrix = (
[2, -
[
[
[5, -2, -3, 3],
);
my @free_terms = (
my ($w, $x, $y, $z) = |cramers_rule(@matrix, @free_terms);
say "w = $w";
say "x = $x";
say "y = $y";
Line 71 ⟶ 74:
{{out}}
<pre>
z = 1
</pre>
Line 110 ⟶ 114:
var matrix = [
[2, -
[
[
[5, -2, -3, 3],
]
var free_terms = [
var (w, x, y, z) = cramers_rule(matrix, free_terms)...;
say "w = #{w}"
say "x = #{x}"
say "y = #{y}"
Line 123 ⟶ 129:
{{out}}
<pre>
z = 1
</pre>
|