Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- static double a[] = new double[10];
- static double b[] = new double[10];
- static double ox[] = new double[10];
- static double oy[] = new double[10];
- static double xy[][] = new double[10][10];
- public static void main(String[] args) {
- init();
- calculation();
- }
- public static void init(){
- b[0] = 1;
- b[1] = 1;
- xy[0][0] = 200;
- xy[0][1] = 700;
- xy[1][0] = 300;
- xy[1][1] = 100;
- oy[0] = 1800;
- oy[1] = 900;
- ox[0] = 1100;
- ox[1] = 1500;
- }
- public static void GetAFactor(){
- double dominator = 0;
- for (int i = 0; i < 10; i++){
- for (int j = 0; j < 10; j++){
- dominator += (xy[i][j] * b[j]);
- }
- a[i] = oy[i] / dominator;
- }
- }
- public static void GetBFactor(){
- double dominator = 0;
- for (int i = 0; i < 10; i++){
- for (int j = 0; j < 10; j++){
- dominator += (xy[j][i] * a[j]);
- }
- b[i] = ox[i] / dominator;
- }
- // b[0] = ox[0] / ((xy[0][0] * a[0]) + (xy[1][0] * a[1]));
- // b[1] = ox[1] / ((xy[0][1] * a[0]) + (xy[1][1] * a[1]));
- }
- public static void calculation(){
- for (int i = 0; i < 7; i++){
- GetAFactor();
- GetBFactor();
- }
- System.out.println(a[0] + "," + a[1] + "," + b[0] + "," + b[1]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement