Continued fraction/Arithmetic/G(matrix ng, continued fraction n1, continued fraction n2): Difference between revisions

Content added Content deleted
m (Minor correction.)
m (Reformatted the output.)
Line 6,761: Line 6,761:
public final class ContinuedFractionArithmeticG2 {
public final class ContinuedFractionArithmeticG2 {


public static void main(String[] aArgs) {
public static void main(String[] aArgs) {
test("[3; 7] + [0; 2]", new NG( new NG8(0, 1, 1, 0, 0, 0, 0, 1), new R2cf(1, 2), new R2cf(22, 7) ),
new NG( new NG4(2, 1, 0, 2), new R2cf(22, 7) ));
test("[3;7] + [0;2]", new NG( new NG8(0, 1, 1, 0, 0, 0, 0, 1), new R2cf(1, 2), new R2cf(22, 7) ),
test("[1; 5, 2] * [3; 7]", new NG( new NG8(1, 0, 0, 0, 0, 0, 0, 1), new R2cf(13, 11), new R2cf(22, 7) ),
new NG( new NG4(2, 1, 0, 2), new R2cf(22, 7) ));
new R2cf(286, 77) );
test("[1;5,2] * [3;7]", new NG( new NG8(1, 0, 0, 0, 0, 0, 0, 1), new R2cf(13, 11), new R2cf(22, 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) ),
new R2cf(286, 77) );
new R2cf(-151, 77) );
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) ),
new R2cf(-151, 77) );
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)) );
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])",
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(1, 0, 0, 0, 0, 0, 0, 1),
new NG( new NG8(0, 1, 1, 0, 0, 0, 0, 1),
new NG( new NG8(0, 1, 1, 0, 0, 0, 0, 1),
Line 6,993: Line 6,992:
{{ out }}
{{ out }}
<pre>
<pre>
Testing: [3;7] + [0;2]
Testing: [3; 7] + [0; 2]
3 1 1 1 4
3 1 1 1 4
3 1 1 1 4
3 1 1 1 4


Testing: [1;5,2] * [3;7]
Testing: [1; 5, 2] * [3; 7]
3 1 2 2
3 1 2 2
3 1 2 2
3 1 2 2


Testing: [1;5,2] - [3;7]
Testing: [1; 5, 2] - [3; 7]
-1 -1 -24 -1 -2
-1 -1 -24 -1 -2
-1 -1 -24 -1 -2
-1 -1 -24 -1 -2


Testing: Divide [] by [3;7]
Testing: Divide [] by [3; 7]
3 7
3 7


Testing: ([0;3,2] + [1;5,2]) * ([0;3,2] - [1;5,2])
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
-1 -3 -5 -1 -2 -1 -26 -3
-1 -3 -5 -1 -2 -1 -26 -3