Commit c83bfe69 authored by Aruchira's avatar Aruchira

Up

parent 3a9a0753
def ge(A, b):
def CJ(A, b):
import numpy
n = len(b)
for j in range(0, n-1):
......@@ -7,17 +9,9 @@ def ge(A, b):
A[i,j:n] = A[i, j:n] - lam*A[j, j:n]
b[i] = b[i] - lam*b[j]
x = b.copy()
for k in range(n-1, -1, -1):
x[k] = (b[k] - dot(a[k,k+1:n], x[k+1:n]))/a[k,k]
print(x)
print('U=',A)
print('C=',d)
import numpy as np
A = np.array([
[4, -2, 1],
[-2, 4, -2],
[1, -2, 4]
], float)
b = np.array([11,-16,17], float)
ge(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