Metode Gauss Seidel : Pengertian, Konsep dan Source Code C++
Hallo... Kali ini kita akan membahas materi metode numerik yaitu metode gauss seidel. Sesuai judul, disini akan dibahas tentang pengertian metode gauss seidel, konsep metode gauss seidel dan contoh penyelesaian soal dengan menggunakan source code metode gauss seidel dengan bahasa C++. Tanpa berlama-lama yuk langsung saja disimak materi di bawah ini...
Pengertian dan Konsep Metode Gauss Seidel
Pengaplikasian Metode Gauss Seidel dengan Bahasa C++
Source code gauss seidel :
#include<iostream>
#include<conio.h>
using namespace
std;
int main(void)
{
float a[10][10], b[10], x[10], y[10];
int n = 0, m = 0, i = 0, j = 0;
cout << "Masukkan ukuran array 2
dimensi : ";
cin >> n;
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
cout << "Masukkan nilai
:(" << i << ", " << j << ") ";
cin >> a[i][j];
}
}
cout << "\nMasukkan nilai ruas
di sebelah kanan : \n";
for (i = 0; i < n; i++)
{
cout << "Masukkan nilai
:(" << i << ", " << j << ") ";
cin >> b[i];
}
cout << "Masukkan nilai awal
x\n";
for (i = 0; i < n; i++)
{
cout << "Masukkan nilai :("
<< i<<"):";
cin >> x[i];
}
cout << "\nMenentukan Iterasi ke
: ";
cin >> m;
while (m > 0)
{
for (i = 0; i < n; i++)
{
y[i] = (b[i] / a[i][i]);
for (j = 0; j < n; j++)
{
if (j == i)
continue;
y[i] = y[i] - ((a[i][j] /
a[i][i]) * x[j]);
x[i] = y[i];
}
printf("x%d = %f ", i + 1, y[i]);
}
cout << "\n";
m--;
}
return 0;
}
setelah program dijalankan, kita harus menginput nilainya sendiri.
Perhatikan gambar dibawah ini :
Normally, gamblers addContent funds to the web playing firm, make bets or play the video games that it offers, 카지노 사이트 and then cash out any winnings. A variety of digital money companies offer accounts with which on-line playing can be funded. The steady technological developments are also favoring market growth to a great extent.
ReplyDelete