ଗସ୍ - ସିଡ଼ାଲ୍ ପଦ୍ଧତି
ଦେଖଣା
ବ୍ୟାଖ୍ୟା
[ସମ୍ପାଦନା]ଗସ-ସିଡ଼ାଲ ପଦ୍ଧତି ହୋଇଛି ଏକ iterative technique ଏବଂ ଏହା ଅଜଣା x ଥିବା n ଗୋଟି linear equation ବିଶିଷ୍ଟ ଗୋଟିଏ square systemକୁ ସମାଧାନ କରିବାରେ ବ୍ୟବହାର କରାଯାଏ:
- .
iterationଦ୍ୱାରା ନିମ୍ନ ମତେ ଏହାର ସଂଜ୍ଞା ପ୍ରକରଣ କରାଯାଇପାରେ
ଏବଂ is the kth approximation or iteration of is the next or k + 1 iteration of , and the matrix A is decomposed into a lower triangular component , and a strictly upper triangular component U: .[୧]
ଆଲ୍ଗୋରିଦିମ୍
[ସମ୍ପାଦନା]Inputs: A, A Output: Choose an initial guess to the solution repeat until convergence for A from 1 until A do for A from 1 until A do if A ≠ A then end if end (A-loop) end (A-loop) check if convergence is reached end (repeat)
ଉଦାହରଣ
[ସମ୍ପାଦନା]ଭାବେ ଗୋଟିଏ linear system ଦର୍ଶଯାଇଛି, ଯଥା:
- ଏବଂ
ଆମେ ନିମ୍ନୋକ୍ତ ସମୀକରଣ
କୁ ନିମ୍ନୋକ୍ତ ରୂପେ ବ୍ୟବହାର କରିବାକୁ ଚାହୁଁ
ଯେଉଁଠାରେ କି:
- ଏବଂ
ପାଇଥନ ୩ ଏବଂ NumPy ବ୍ୟବହାର କରାଯାଇଥିବା ଏକ ଉଦାହରଣ
[ସମ୍ପାଦନା]The following numerical procedure simply iterates to produce the solution vector.
import numpy as np
ITERATION_LIMIT = 1000
# initialize the matrix
A = np.array([[10., -1., 2., 0.],
[-1., 11., -1., 3.],
[2., -1., 10., -1.],
[0.0, 3., -1., 8.]])
# initialize the RHS vector
b = np.array([6., 25., -11., 15.])
# prints the system
print("System:")
for i in range(A.shape[0]):
row = ["{}*x{}".format(A[i, j], j + 1) for j in range(A.shape[1])]
print(" + ".join(row), "=", b[i])
print()
x = np.zeros_like(b)
for it_count in range(ITERATION_LIMIT):
print("Current solution:", x)
x_new = np.zeros_like(x)
for i in range(A.shape[0]):
s1 = np.dot(A[i, :i], x_new[:i])
s2 = np.dot(A[i, i + 1:], x[i + 1:])
x_new[i] = (b[i] - s1 - s2) / A[i, i]
if np.allclose(x, x_new, rtol=1e-8):
break
x = x_new
print("Solution:")
print(x)
error = np.dot(A, x) - b
print("Error:")
print(error)
ଏହାର output ଆସିବ:
System:
10.0*x1 + -1.0*x2 + 2.0*x3 + 0.0*x4 = 6.0
-1.0*x1 + 11.0*x2 + -1.0*x3 + 3.0*x4 = 25.0
2.0*x1 + -1.0*x2 + 10.0*x3 + -1.0*x4 = -11.0
0.0*x1 + 3.0*x2 + -1.0*x3 + 8.0*x4 = 15.0
Current solution: [ 0. 0. 0. 0.]
Current solution: [ 0.6 2.32727273 -0.98727273 0.87886364]
Current solution: [ 1.03018182 2.03693802 -1.0144562 0.98434122]
Current solution: [ 1.00658504 2.00355502 -1.00252738 0.99835095]
Current solution: [ 1.00086098 2.00029825 -1.00030728 0.99984975]
Current solution: [ 1.00009128 2.00002134 -1.00003115 0.9999881 ]
Current solution: [ 1.00000836 2.00000117 -1.00000275 0.99999922]
Current solution: [ 1.00000067 2.00000002 -1.00000021 0.99999996]
Current solution: [ 1.00000004 1.99999999 -1.00000001 1. ]
Current solution: [ 1. 2. -1. 1.]
Solution:
[ 1. 2. -1. 1.]
Error:
[ 2.06480930e-08 -1.25551054e-08 3.61417563e-11 0.00000000e+00]
Program to solve arbitrary no. of equations using Matlab
[ସମ୍ପାଦନା]The following code uses the formula
function [x] = gauss_seidel(A, b, x0, iters)
n = length(A);
x = x0;
for k = 1:iters
for i = 1:n
x(i) = (1/A(i, i))*(b(i) - A(i, 1:n)*x + A(i, i)*x(i));
end
end
end
ଆହୁରି ଦେଖନ୍ତୁ
[ସମ୍ପାଦନା]- Jacobi method
- Successive over-relaxation
- Iterative method. Linear systems
- Gaussian belief propagation
- Matrix splitting
- Richardson iteration
ଟୀକା
[ସମ୍ପାଦନା]- ↑ Gauss 1903, p. 279 .
ଆଧାର
[ସମ୍ପାଦନା]- Gauss, Carl Friedrich (1903), Werke (in German), vol. 9, Göttingen: Köninglichen Gesellschaft der Wissenschaften
{{citation}}
: CS1 maint: unrecognized language (link). - Gauss, Carl Friedrich (1903), Werke (in German), vol. 9, Göttingen: Köninglichen Gesellschaft der Wissenschaften
{{citation}}
: CS1 maint: unrecognized language (link). - Gauss, Carl Friedrich (1903), Werke (in German), vol. 9, Göttingen: Köninglichen Gesellschaft der Wissenschaften
{{citation}}
: CS1 maint: unrecognized language (link)
ବାହାର ଲିଙ୍କ
[ସମ୍ପାଦନା]- Hazewinkel, Michiel, ed. (2001), "Seidel method", Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4
- Gauss–Seidel from www.math-linux.com Archived 2013-03-05 at the Wayback Machine.
- Module for Gauss–Seidel Iteration
- Gauss–Seidel From Holistic Numerical Methods Institute
- Gauss Siedel Iteration from www.geocities.com
- The Gauss-Seidel Method
- Bickson
- Matlab code Archived 2009-08-12 at the Wayback Machine.
- C code example