Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
공학수학 1: Misc change
Browse files Browse the repository at this point in the history
  • Loading branch information
simnalamburt committed May 4, 2021
1 parent a18fd5d commit b57f81d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
11 changes: 6 additions & 5 deletions 공학수학 1/gauss-seidel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
]

B = [
50,
50,
25,
25,
50.,
50.,
25.,
25.,
]

# Initial values
u11, u21, u12, u22 = 0, 0, 0, 0
u11, u21, u12, u22 = 0., 0., 0., 0.
print(f'U = [{u11} {u21} {u12} {u22}]')

for _ in range(20):
v11 = A[0][0]*u11 + A[0][1]*u21 + A[0][2]*u12 + A[0][3]*u22 + B[0]
Expand Down
14 changes: 8 additions & 6 deletions 공학수학 1/jacobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
])

B = np.array([
50,
50,
25,
25,
50.,
50.,
25.,
25.,
])

# Initial values
U = np.array([0, 0, 0, 0])
U = np.array([0., 0., 0., 0.])
print(f'U = {U}')

for _ in range(20):
U = A@U + B
V = A@U + B
U = A@V + B
print(f'U = {U}')

0 comments on commit b57f81d

Please sign in to comment.