Commit 6e06af00 authored by Littichai Buddaken's avatar Littichai Buddaken

add

parent 22154fa8
import numpy as np
def solve(A,b):
A = np.array(A,float)
b = np.array(b,float)
n = len(b)
for k in range(0,n-1):
for i in range(k+1,n):
lam = A[i,k]/A[k,k]
A[i,k]=0
A[i,k+1:n] -= A[k,k+1:n]
b[i] -= lam*b[k]
x=b.copy()
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]
print("x =",x)
"""
Example test.
"""
from hamcrest import (
assert_that,
equal_to,
is_,
)
def test_math():
assert_that(1 + 1, is_(equal_to(2)))
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