Advertisement
korenizla

gauss

Oct 15th, 2022
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. # Importing NumPy Library
  2. import numpy as np
  3. import sys
  4.  
  5. # Reading number of unknowns
  6. n = int(input('Enter number of unknowns: '))
  7.  
  8. # Making numpy array of n x n+1 size and initializing
  9. # to zero for storing augmented matrix
  10. a = np.zeros((n,n+1))
  11.  
  12. # Making numpy array of n size and initializing
  13. # to zero for storing solution vector
  14. x = np.zeros(n)
  15.  
  16. # Reading augmented matrix coefficients
  17. print('Enter Augmented Matrix Coefficients:')
  18. for i in range(n):
  19.     for j in range(n+1):
  20.         a[i][j] = float(input( 'a['+str(i)+']['+ str(j)+']='))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement