Nadhif Rizki Priambodo
Revision as of 15:10, 14 October 2019 by Bobdibalikbob (talk | contribs)
[Nama : Nadhif rizki priambodo]
[Semester : 5]
[Npm : 1706026140]
Mengikuti lomba kompetisi mobil hemat energi dan shell eco marathon tahun 2018-2020
HASIL QUIZ
coding print ("QUIZ nadhif rizki p - 1706026140") A = np.array([[1, 2, 0, -2, 0], [0, 1, 0, 2, -1], [0, 1, -1, 1, -1], [0, 0, 0, -1, 1], [0, 0, 2, 1, 2]], float) B=np.array([-4, 1, -1, -2, 1],float)
n=len(A)
- menggunakan gauss elimination
for k in range (0,n-1):
for i in range (k+1, n): if A[i,k] ! = 0 lam= A[i,k]/A[k,k] A[i,k:n]= A[i,k:n]-(A[k,k:n]*lam) B[i]=B[i]-(B[k]*lam)
print ("matrix A:", "\n", A)
x=np.zeros( n,float) for m in range ( n-1, -1, -1)P:
x[m]=(B[m]-np.dot(A[m, m+1:n], x[m+1:n]))/A[m,m] print ('nilai x', m+1, '=', x[m])
SCREENSHOT HASIL