-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab.java
More file actions
58 lines (58 loc) · 2.03 KB
/
lab.java
File metadata and controls
58 lines (58 loc) · 2.03 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
public class lab {
public static void main(String args[]) {
double b[][] = new double[6][20];
float x[] = new float[20];
short a[] = new short[6];
for (int i = 0; i < x.length; i++) {
double num = Math.random() * 25;
num = num - 14.0f;
float num1 = (float) num;
x[i] = num1;
}
int k = 0;
for (short i = 6; i <= 16; i++) {
if (i % 2 == 0) {
a[k] = i;
k++;
}
}
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 20; j++) {
if (a[i] == 14) {
double number = Math.abs(x[j]);
double num1 = 1.0 / 3.0;
number = Math.pow(number, num1);
number = -number;
b[i][j] = Math.asin(Math.pow(Math.E, number));
}
if (a[i] == 6 | a[i] == 8 | a[i] == 12) {
double p1 = Math.cos(x[j]);
p1 = Math.pow(p1, 2);
p1 = Math.abs(p1);
p1 = Math.pow(p1, 1.0 / 3.0);
p1 = -p1;
b[i][j] = Math.atan(Math.pow(Math.E, p1));
} else {
double p2 = Math.cos(x[i]);
double p3 = Math.sin(x[i]);
p2 = Math.abs(p2);
double p4 = Math.pow(Math.E, p2);
p2 = -p2;
p3 = Math.abs(p3);
double p5 = Math.pow(p3, 2 * p4);
p5 = Math.abs(p5);
p5 = Math.pow(p5, 1.0 / 3.0);
p5 = -p5;
b[i][j] = Math.atan(Math.pow(Math.E, p5));
}
}
}
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 20; j++) {
String answer = String.format("%.3f", b[i][j]);
System.out.print(" " + answer + " ");
}
System.out.println();
}
}
}