1 HAMPIRAN NUMERIK SOLUSI PERSAMAAN LANJAR Pertemuan 5 Matakuliah: K0342 / Metode Numerik I Tahun: 2006 TIK:Mahasiswa dapat meghitung nilai hampiran numerik solusi persamaan lanjar
2 PERTEMUAN 5 HAMPIRAN NUMERIK SOLUSI PERSAMAAN LANJAR TIK:Mahasiswa dapat meghitung nilai hampiran numerik solusi persamaan lanjar
3 Bentuk umum persamaan lanjar (linier) bujur sangkar: Untuk i = 1,2,3,…,n
4 Solusi persamaan lanjar Eliminasi Gauss Eliminasi Gauss- Jordan Matriks balikan Dekomposisi LU Iterasi Jacobi Iterasi Gauss- Seidel
5 Gauss Elimination Consider n equations in n unknowns The solution vector, x, for this system of equations remains unchanged if either of the following fundamental row operations are performed: –Multiply or divide any equation by a constant. –Replace any equation by the sum of that equation and any other equation.
6 Forward Elimination b’ k = b k (a 11 ) – b 1 (a k1 ) k = 2,3,4,…,n
7 Forward Elimination b’ k = b k (a ’ 22 ) – b 2 (a k2 ) k = 3,4,…,n
8 Forward Elimination
9 Back Substitution Finally
10 Gauss Elimination
11 Gauss Elimination
12 Gauss Elimination
13 Example Forward Elimination
14 Example Back Substitution
15 GAUSS-JORDAN ELIMINATON
16 GAUSS-JORDAN ELIMINATON
17 Contoh: Selesaikan SPL berikut dengan eliminasi Gass-Jordan Jawaban: Matriks perluasan(augmented matrix) dari koefisien SPL: b ’ 1 = b 1 /3
18 b ’ 2 = b 2 – 0.1 b 1 b ’ 3 = b 3 – 0.3 b 1 b ” 2 = b ’ 2 /
19 b ” 1 = b ’ b ” 2 b ” 3 = b ’ b” 2 b ”’ 3 = b ” 3 /
20 b ”’ 1 = b ” b ”’ 3 b ”’ 2 = b ’’ b”’ 3
21 Iterative Methods Consider the linear system
22 Solution Methods Gauss Elimination – Subject to roundoff errors and ill conditioning Iterative methods -- Alternative to elimination method Take initial guess of solution and then iterate to obtain improved estimates of the solution Jacobi and Gauss-Seidel methods Work well for large sets of equations
23 Iterative Methods Rearrange the equations so that an unknown is on the left-hand side of each equation: Initial guess
24 Jacobi Method Initial guess Next approximation of the solution
25 Jacobi Method After k iterations of this process
26 Example – Jacobi Method System of 3 equations in 3 unknowns Rearrange
27 Example – Jacobi Method Initial guess After 20 iterations
28 Errors and Stopping Criteria How do we know when to stop? Two major sources of error in numerical methods: –Roundoff error: Computers represent quantities with a finite number of digits –Truncation error: Numerical methods employ approximations to represent exact mathematical operations and quantities Consider the error between the numerical and analytical solutions –True value –Approximate value
29 Error Measures True value = Approximate value + Error = Error = True value - Approximate value r = relative error d = significant digits
30 Example Pi ~ Better approximation x = Find the error, relative error and the number of significant digits in the approximation.
31 Error Perkiraan A is the approximate error between the current approximate value and our previous approximate value
32 Example Estimate exp(x) for x = 0.5 by adding more and more terms to the sequence and computing the errors after adding each new term. Add terms until the estimate is valid to three significant digits. From a calculators x =
33 Example Using only the first term of the series, Using the first and second terms of the series,and so on … # of TermsResult
34 Jacobi Methode We stop when
35 Gauss Seidel Methode The current approximation of one of the unknowns is available for use after each step. This information could be used immediately in the calculation of the next unknown
36 Contoh metode Gauss-Seidel after 1 iteration of the method convenient initial guess
37 after 2 nd iterations after 9 th iterations after 1 st iteration
38 Terima kasih