Paste Search Dynamic
Recent pastes
np.array
  1. import numpy as np
  2.  
  3. A=np.array([[2,1,-1],
  4.            [-3,-2,2],
  5.            [-2,1,2]])
  6.  
  7. b=np.array([8,-11,-3])
  8.  
  9. N=len(b)
  10. x=np.zeros(N)
  11.  
  12. for i in range(N-1):
  13.     b[i]=b[i]/A[i][i]
  14.     A[i]=A[i]/A[i][i]
  15.     for k in range(i+1,N):
  16.         b[k]=b[k]-A[i][k]*b[i]
  17.         A[k]=A[k]-A[k][i]*A[i]
  18.  
  19. i=N-1
  20. b[i]=b[i]/A[i][i]
  21. A[i]=A[i]/A[i][i]
  22.  
  23. print(A,b)
  24.  
  25.  
Parsed in 0.003 seconds