Commit 08200587 authored by Kittisak Maneewong's avatar Kittisak Maneewong

ส่งงาน week05

parent c9a07a0d
...@@ -14,10 +14,10 @@ def ge(A,b): ...@@ -14,10 +14,10 @@ def ge(A,b):
b[i] = b[i] - lam * b[k] b[i] = b[i] - lam * b[k]
# back # back
x = b.copy() x = b.copy()
print(x)
for k in range(n - 1, -1, -1): for k in range(n - 1, -1, -1):
x[k] = (b[k] - np.dot(A[k, k + 1:n], x[k + 1:n])) / A[k, k] x[k] = (b[k] - np.dot(A[k, k + 1:n], x[k + 1:n])) / A[k, k]
print(x) for i,x in zip(range(1,len(x)+1),x):
print("x_{} = {}".format(i,x))
def solve(A,b): def solve(A,b):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment