Continued fraction/Arithmetic/G(matrix ng, continued fraction n1, continued fraction n2): Difference between revisions
Continued fraction/Arithmetic/G(matrix ng, continued fraction n1, continued fraction n2) (view source)
Revision as of 17:20, 20 November 2023
, 5 months ago→{{header|Wren}}: Changed to Wren S/H
m (Minor correction.) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1:
{{
This task performs the basic mathematical functions on 2 continued fractions. This requires the full version of matrix NG:
: <math>\begin{bmatrix}
Line 6,761:
public final class ContinuedFractionArithmeticG2 {
public static void main(String[] aArgs) {
test("[
new NG( new NG4(2, 1, 0, 2), new R2cf(22, 7) ));
test("[
test("[1; 5, 2]
test("Divide [] by [3; 7]",▼
▲ test("[1;5,2] - [3;7]", new NG( new NG8(0, 1, -1, 0, 0, 0, 0, 1), new R2cf(13, 11), new R2cf(22, 7) ),
▲ test("Divide [] by [3;7]",
new NG( new NG8(0, 1, 0, 0, 0, 0, 1, 0), new R2cf(22 * 22, 7 * 7), new R2cf(22,7)) );
test("([0; 3, 2] + [1; 5, 2]) * ([0; 3, 2] - [1; 5, 2])",
new NG( new NG8(1, 0, 0, 0, 0, 0, 0, 1),
new NG( new NG8(0, 1, 1, 0, 0, 0, 0, 1),
Line 6,796 ⟶ 6,795:
private static abstract class MatrixNG {
protected int configuration = 0;
Line 6,993 ⟶ 6,992:
{{ out }}
<pre>
Testing: [3; 7] + [0; 2]
3 1 1 1 4
3 1 1 1 4
Testing: [1; 5, 2] * [3; 7]
3 1 2 2
3 1 2 2
Testing: [1; 5, 2] - [3; 7]
-1 -1 -24 -1 -2
-1 -1 -24 -1 -2
Testing: Divide [] by [3; 7]
3 7
Testing: ([0; 3, 2] + [1; 5, 2]) * ([0; 3, 2] - [1; 5, 2])
-1 -3 -5 -1 -2 -1 -26 -3
-1 -3 -5 -1 -2 -1 -26 -3
Line 10,886 ⟶ 10,885:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="
construct new() {
_cfn = 0
|