Created by Roman on 10 04 14 public class Lab_6 private static final d

 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
/**
* Created by Roman on 10.04.14.
*/
public class Lab_6 {
private static final double A_1 = 0;
private static final double B_1 = 1;
private static final double A_2 = 0;
private static final double B_2 = 1.57;
private static final double C = 0.5;
private static final double D = 1.5;
private static final double M = 10;
private static final double U = -0.01;
private static final double[] T = new double[]{-0.90617985, -0.53846931, 0, 0.53846931, 0.90617985};
private static final double[] A = new double[]{0.23692688, 0.47862868, 0.56888889, 0.47862868, 0.23692688};
public static void main(String... args) {
double[] f_t = new double[(int) M];
double[] t = new double[(int) M];
double[] x = new double[(int) M];
for (int i = 0; i < (int) M; i++) {
double result = 0;
f_t[i] = C + i * ((D - C) / M);
for (int j = 0; j < T.length; j++) {
x[j] = (B_2 + A_2) / 2 + ((B_2 - A_2) / 2) * T[j];
double _func = Math.sqrt(2 * Math.cosh(f_t[i] / (1 + Math.pow(x[j], 2)) + U * x[j]) - 1) * ((2 - 3 * x[j]) / (4 + Math.pow(x[j], 2)));
result += A[j] * _func;
}
t[i] = result;
}
for (int index = 0; index < (int) M; index++) {
System.out.println("t[" + index + "] = " + f_t[index]);
}
System.out.println("----------------------");
for (int index = 0; index < (int) M; index++) {
System.out.println("F(t)[" + index + "] = " + t[index]);
}
}
}