Solve equations with substitution method: Difference between revisions

→‎{{header|Raku}}: Added Raku solution
(Created page with "{{Draft task}} ;Task: <br>Let given equations: <br>3x + y = -1 and 2x - 3y = -19 <br>Solve it with substitution method. <br><br> =={{header|Ring}}== <lang ring> firstEquatio...")
 
(→‎{{header|Raku}}: Added Raku solution)
Line 6:
<br>Solve it with substitution method.
<br><br>
 
=={{header|Raku}}==
<lang perl6>sub solve-system-of-two-linear-equations ( [ \a1, \b1, \c1 ], [ \a2, \b2, \c2 ] ) {
my \X = ( b2 * c1 - b1 * c2 )
/ ( b2 * a1 - b1 * a2 );
 
my \Y = ( a1 * X - c1 ) / -b1;
 
return X, Y;
}
say solve-system-of-two-linear-equations( (3,1,-1), (2,-3,-19) );</lang>
{{out}}
<pre>(-2 5)</pre>
 
=={{header|Ring}}==
256

edits