Commit 0eb7ba7e authored by Aruchira's avatar Aruchira

Up

parent 3d183116
# 59110440156
# nattapong samanpong
def ge(A, b):
#59110440156
#นายณัฐพงษ์ สมานพงษ์
def ge(A,):
pass
def solve(A, b):
pass
def solve(A,b):
import numpy.linalg
result = numpy.linalg.solve(A,b)
for x in result
print('Sx_l{}S'.format(x))
#5x3
m,n= map(int,input().split('x'))
print(n,m)
A=[]
for i in rang(m)
A.apprnd(list(map(int,inpt().split(','))))
print(n,)
b = list(map(int,input().split(',')))
def CJ(A, b):
import numpy
n = len(b)
for j in range(0, n-1):
for i in range(j+1, n):
lam = A[i,j]/A[j,j]
A[i,j:n] = A[i, j:n] - lam*A[j, j:n]
b[i] = b[i] - lam*b[j]
print('U=',A)
print('C=',d)
def ge(A, b):
# 1. elimination
n = len(b)
for j in range(0, n-1): # pivot equation
for i in range(j+1, n):
lam = A[i,j]/A[j,j]
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] - np.dot(A[k,k+1:n], x[k+1:n]))/A[k,k]
print(x)
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