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
45
46
47
/**
* 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};
private static double func(double x, double ti, double u) {
return Math.sqrt(2 * Math.cosh(ti / (1 + Math.pow(x, 2)) + u * x) - 1) * ((2 - 3 * x) / (4 + Math.pow(x, 2)));
}
public static void main(String... args) {
double[] Fti = new double[(int) M];
double[] m2 = new double[(int) M];
double[] x2 = new double[(int) M];
for (int i = 0; i < (int) M; i++) {
double mm2 = 0;
Fti[i] = C + i * ((D - C) / M);
for (int j = 0; j < T.length; j++) {
x2[j] = (B_2 + A_2) / 2 + ((B_2 - A_2) / 2) * T[j];
mm2 += A[j] * func(x2[j], Fti[i], U);
}
m2[i] = mm2;
}
for (int index = 0; index < (int) M; index++) {
System.out.println("F(x)[" + index + "] = " + Fti[index]);
}
System.out.println("----------------------");
for (int index = 0; index < (int) M; index++) {
System.out.println("t[" + index + "] = " + m2[index]);
}
}
}