SHARE
TWEET

Untitled

a guest Apr 21st, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void iter(float a[50][50], float(&x)[50][50], int ite, int n)
  2. {
  3.     int suma;
  4.     for (int i = 1; i <= n; i++)
  5.     {
  6.         suma = x[0][i];
  7.         for (int j = 1; j < i; j++)    // first sum in 7.66 formula from instruction
  8.         {
  9.             suma += (-a[i][j]) / (a[i][i]) * x[ite][j];
  10.             x[ite][i] = suma;    
  11.         }
  12.  
  13.         suma = 0;
  14.         for (int j = i; j <= n; j++)    // second sum from 7.66 formula
  15.         {
  16.             suma += ((-a[i][j]) / (a[i][i])) * (x[ite - 1][i]);
  17.  
  18.         }
  19.         x[ite][i] += (a[i][n] / a[i][i]) + suma;    // whole 7.66 formula
  20.         cout << "x[" << ite << "][" << i << "] = " << x[ite][i] << endl;
  21.     }
  22. }
RAW Paste Data
Top