-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.java
More file actions
36 lines (22 loc) · 707 Bytes
/
Matrix.java
File metadata and controls
36 lines (22 loc) · 707 Bytes
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
31
32
33
34
35
36
import java.lang.Math;
public class Matrix
{
private Vector row1;
private Vector row2;
public Matrix(Vector one, Vector two)
{
row1 = one;
row2 = two;
}
double[] eigenValues(){
double[] ev = new double[2];
int a = (row1.getX() + row2.getY());
double b = Math.sqrt( Math.pow((row1.getX() + row2.getY()), 2) - 4*(row1.getX()*row2.getY() - row2.getX()*row1.getY()) );
ev[0] = (a + b) / 2;
ev[1] = (a - b) / 2;
return ev;
}
double det(){
return (row2.getY() * row1.getX()) - (row2.getX() * row1.getY());
}
}