Andika Ramadhan Gurnida

From ccitonlinewiki
Revision as of 17:36, 16 October 2019 by Andikarg (talk | contribs) (Created page with "'''QUIZ 2''' #ProbSet 2.1 no.6 #jawaban from numpy import linalg import numpy as np #Definisi row1 = [0,0,2,1,2] row2 = [0,1,0,2,-1] row3 = [1,2,0,-2,0] row4 = [0,0,0,-1,1] ro...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

QUIZ 2

  1. ProbSet 2.1 no.6
  2. jawaban

from numpy import linalg import numpy as np

  1. Definisi

row1 = [0,0,2,1,2] row2 = [0,1,0,2,-1] row3 = [1,2,0,-2,0] row4 = [0,0,0,-1,1] row5 = [0,1,-1,1,-1] nmat = np.array([row1,row2,row3,row4,row5]) print("n matrix are:") print(nmat) cons = np.array([1,1,-4,-2,-1]) print("Y matrix are:") print(cons)

  1. Penyelesaian

Ans = linalg.solve(nmat,cons) x1val=int(Ans[0]) x2val=int(Ans[1]) x3val=int(Ans[2]) x4val=int(Ans[3]) x5val=int(Ans[4]) print("x result are:") print("x1=",x1val) print("x2=",x2val) print("x3=",x3val) print("x4=",x4val) print("x5=",x5val)