Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KwadraturaGaussa {
- static double[] x = {0, 5, 5, 0};
- static double[] y = {0, 0, 5, 5};
- static double[] waga = {1, 1};
- static double[] punkt = {-0.5773502692, 0.5773502692};
- static double[][][] fksztalt = new double[2][2][4];
- static double[][] poch_ksi = new double[2][4];
- static double[][] poch_ni = new double[2][4];
- static double[][] fun_detj = new double[2][2];
- static double dxdksi ;
- static double dydksi ;
- static double dxdni ;
- static double dydni;
- static void funk() {
- for (int i = 0; i < punkt.length; i++) {
- for (int j = 0; j < punkt.length; j++) {
- fksztalt[j][i][0] = 0.25 * (1.0 - punkt[j]) * (1.0 - punkt[i]);
- fksztalt[j][i][1] = 0.25 * (1.0 + punkt[j]) * (1.0 - punkt[i]);
- fksztalt[j][i][2] = 0.25 * (1.0 + punkt[j]) * (1.0 + punkt[i]);
- fksztalt[j][i][3] = 0.25 * (1.0 - punkt[j]) * (1.0 + punkt[i]);
- poch_ksi[i][0] = -0.25 * (1.0 - punkt[i]);
- poch_ksi[i][1] = 0.25 * (1.0 - punkt[i]);
- poch_ksi[i][2] = 0.25 * (1.0 + punkt[i]);
- poch_ksi[i][3] = -0.25 * (1.0 + punkt[i]);
- poch_ni[j][0] = -0.25 * (1.0 - punkt[j]);
- poch_ni[j][1] = -0.25 * (1.0 + punkt[j]);
- poch_ni[j][2] = 0.25 * (1.0 + punkt[j]);
- poch_ni[j][3] = 0.25 * (1.0 - punkt[j]);
- }
- }
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++) {
- dxdksi = poch_ksi[i][0] * (x[0]) + poch_ksi[i][1] * (x[1]) +
- poch_ksi[i][2] * (x[2]) + poch_ksi[i][3] * (x[3]);
- dydksi = poch_ksi[i][0] * y[0] + poch_ksi[i][1] * y[1] +
- poch_ksi[i][2] * y[2] + poch_ksi[i][3] * y[3];
- dxdni = poch_ni[j][0] * (y[0]) + poch_ni[j][1] * (y[1]) +
- poch_ni[j][2] * (y[2]) + poch_ni[j][3] * (y[3]);
- dydni = poch_ni[j][0] * y[0] + poch_ni[j][1] * y[1] +
- poch_ni[j][2] * y[2] + poch_ni[j][3] * y[3];
- fun_detj[i][j] = dxdksi*dydni - dxdni*dydksi;
- }
- }
- double powierzchnia = 0.0;
- for (int i = 0; i < punkt.length; i++) {
- for (int j = 0; j < punkt.length; j++) {
- powierzchnia += Math.abs(fun_detj[i][j]);
- }
- }
- System.out.println(powierzchnia);
- }
- public static void main(String[] args)
- {
- KwadraturaGaussa kg = new KwadraturaGaussa();
- funk();
- // Initial Values ---- TO BYLO W INNYM PROJEKCIE
- float x0 = 0;
- float y0 = 1;
- float h = (float) 0.5;
- float x = (float) 3;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement