package ru kpfu itis group11402 batyrova Task055 import ru kpfu itis g

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ru.kpfu.itis.group11402.batyrova.Task055;
import ru.kpfu.itis.group11402.batyrova.Task050.RationalFraction;
import ru.kpfu.itis.group11402.batyrova.Task053.RationalVector2D;
/**
* @author Elvira Batyrova
* 402
* for 055
*/
public class TestClass {
public static void main(String[] args) {
RationalFraction r = new RationalFraction();
RationalFraction r2 = new RationalFraction(3, 2);
RationalFraction r3 = new RationalFraction(1, 2);
RationalFraction r4 = new RationalFraction(2, 4);
RationalMatrix2x2 rm = new RationalMatrix2x2();
RationalMatrix2x2 rm1 = new RationalMatrix2x2(r2);
RationalMatrix2x2 rm2 = new RationalMatrix2x2(r2, r3, r4, r2);
RationalMatrix2x2 rm3 = new RationalMatrix2x2(new RationalFraction[][]{{r2,r3},{r4,r2}});
RationalMatrix2x2 rm4 = rm1.add(rm2);
RationalMatrix2x2 rm5 = rm1.mult(rm2);
System.out.println(rm4);
System.out.println(rm5);
System.out.println(rm2.det());
RationalVector2D rv = new RationalVector2D(r2,r3);
RationalVector2D rv1 = rm2.multVector(rv);
System.out.println(rv1);
}
}