07 Jacobi Iteration

Gabriel Gamana
27 Jul 202016:50

Summary

TLDRIn this educational video, Gabriel Gamana introduces the concept of Jacobi Iteration, a method for solving systems of linear equations. The video explains how to rearrange equations for iterative computation and checks for diagonal dominance to ensure convergence. Gamana demonstrates the process with an example, showing how to achieve a solution through iterative refinement until a stopping criterion is met. The video concludes with a practical demonstration of implementing Jacobi Iteration in MS Excel, showcasing the power of iterative methods in solving complex mathematical problems.

Takeaways

  • πŸ“š The video introduces Chapter 2 on systems of equations, focusing on the Jacobi iteration method.
  • πŸ” Jacobi iteration is a technique used for solving systems of linear equations iteratively.
  • πŸ’‘ The method involves rearranging equations to isolate each variable, similar to the fixed point method.
  • πŸ“ For Jacobi iteration to converge, the matrix must be diagonally dominant, where the absolute value of each diagonal element is greater than the sum of the absolute values of the off-diagonal elements in its row.
  • πŸ“ The video demonstrates how to check if a matrix is diagonally dominant by comparing the absolute values of the elements.
  • πŸ”’ The script includes a practical example where a system of linear equations is solved using Jacobi iteration with a stopping criterion of 0.001.
  • πŸ”„ Iterative steps are shown, with initial guesses and subsequent refinements until the stopping criterion is met.
  • πŸ“Š The video concludes with a demonstration of how to implement the Jacobi iteration method using MS Excel and VBA for automated computation.
  • πŸ’» The script explains the use of arrays in VBA to handle multiple values efficiently, which is crucial for solving systems of equations.
  • πŸ”— The video provides a step-by-step guide on setting up the VBA code for Jacobi iteration, including defining variables, using loops for iteration, and presenting results.

Q & A

  • What is the main topic discussed in Chapter 2 of the video?

    -The main topic discussed in Chapter 2 of the video is the system of equations, with a focus on the first topic, Jacobi iteration.

  • What is the difference between the problems discussed in Chapter 1 and Chapter 2?

    -In Chapter 1, the focus is on determining the value of 'x' that satisfies a single equation, f(x) = 0. In contrast, Chapter 2 deals with determining the values of x1, x2, up to xn that simultaneously satisfy a set of equations, which can be either linear or non-linear.

  • What is meant by a 'simultaneous correction method' in the context of Jacobi iteration?

    -A 'simultaneous correction method' refers to the approach where no component of an approximation is used until all components of that approximation have been computed, as opposed to using an updated value as soon as it's available.

  • How is the Jacobi iteration method different from the fixed point method?

    -While both methods involve rearranging equations, the Jacobi iteration method specifically ensures that no component of an approximation is used until all components of the current iteration have been computed.

  • What is a diagonally dominant matrix and why is it important for Jacobi iteration?

    -A diagonally dominant matrix is one where the absolute value of the diagonal element in each row is greater than the sum of the absolute values of the off-diagonal elements in that row. This property is important for Jacobi iteration because it helps ensure the convergence of the method.

  • What is the stopping criterion used in the example problem in the video?

    -The stopping criterion used in the example problem is 0.001, which means the iteration process will stop when the relative error between successive approximations is less than or equal to 0.001.

  • How does the video demonstrate the convergence of the Jacobi iteration method?

    -The video demonstrates the convergence of the Jacobi iteration method by solving a system of linear equations manually and showing that after 10 iterations, the solution converges with a stopping criterion of 0.001.

  • What is the purpose of using arrays in the computerized computation of Jacobi iteration as shown in the video?

    -Arrays are used in the computerized computation to efficiently handle and store multiple values, such as the coefficients and variables in the matrix, instead of using individual variables for each element.

  • How does the video guide the viewer to implement the Jacobi iteration method in MS Excel using VBA?

    -The video guides the viewer through creating a VBA macro that performs the Jacobi iteration method. It involves defining variables, using arrays to handle matrix data, and implementing iterative loops with a stopping criterion to find the solution.

  • What is the significance of the 'U-Bound' function mentioned in the video?

    -The 'U-Bound' function in VBA is used to determine the upper bound of an array, which helps in understanding the size of the matrix and is crucial for correctly implementing the Jacobi iteration method.

Outlines

00:00

πŸ“š Introduction to Systems of Equations and Jacobi Iteration

Gabriel Gamana introduces Chapter 2 on systems of equations, focusing on the Jacobi iteration method. The chapter aims to find values of variables that satisfy multiple equations simultaneously, which can be linear or non-linear. The general form of linear algebraic equations is presented, and the concept of matrix form is introduced. The video discusses iterative methods for solving these systems, particularly the Jacobi iteration, which is a simultaneous correction method. The method involves rearranging equations similar to the fixed point method and requires the matrix to be diagonally dominant for convergence. An example problem is presented to demonstrate the method, with a stopping criterion of 0.001.

05:02

πŸ” Implementing Jacobi Iteration with Initial Guesses

The video script details the process of implementing Jacobi iteration with initial guesses for the variables. The first iteration is calculated using the rearranged equations, and the results are presented. The relative errors for each variable are calculated and compared against the stopping criterion. The process continues for subsequent iterations, refining the values of the variables and recalculating the relative errors until convergence is achieved. The script illustrates the iterative process with specific numerical examples, showing how the values of the variables are updated in each iteration.

10:04

πŸ’» Automating Jacobi Iteration with Excel and VBA

The script transitions to a discussion on automating the Jacobi iteration process using Microsoft Excel and Visual Basic for Applications (VBA). It explains the use of arrays to store matrix values and the process of defining variables and their types for the VBA script. The iterative process is implemented using a series of 'Do Until' loops within the VBA code. The script includes instructions for extracting matrix information from Excel using input boxes and functions like 'UBound'. The video concludes with a demonstration of the VBA code's output, showing the number of iterations required for convergence and the final values of the variables.

15:05

πŸŽ“ Conclusion and Final Thoughts on Jacobi Iteration

The final paragraph of the script summarizes the video's content, highlighting the key takeaways from the manual and computerized computations of the Jacobi iteration. The presenter expresses hope that the viewers have gained a new understanding of solving systems of equations using the Jacobi method. The video concludes with a thank you to the viewers and a reminder to stay safe, signaling the end of the tutorial.

Mindmap

Keywords

πŸ’‘Systems of Equations

A system of equations refers to a collection of two or more equations that need to be solved simultaneously. In the context of the video, Gabriel Gamana discusses how to determine the values of multiple variables that satisfy a set of equations, which can be linear or non-linear. This is the central theme of the video, as it sets the stage for the introduction of methods to solve such systems, like the Jacobi iteration.

πŸ’‘Jacobi Iteration

The Jacobi iteration is a method used to solve systems of linear equations iteratively. It is a simultaneous correction method where each component of an approximation is updated using the most recent values of all other components. In the video, Gamana explains that this method requires rearranging the equations in a specific way and then iterating until convergence is achieved, which is a key step in solving the example problem provided.

πŸ’‘Convergence

Convergence in the context of iterative methods like Jacobi iteration refers to the process of successive approximations getting closer and closer to the true solution. The video emphasizes that for the Jacobi iteration to converge, the matrix involved must be diagonally dominant, which is a condition where the absolute value of each diagonal element is greater than the sum of the absolute values of the off-diagonal elements in its row.

πŸ’‘Diagonally Dominant Matrix

A diagonally dominant matrix is a square matrix in which the absolute value of each diagonal element is greater than or equal to the sum of the absolute values of the non-diagonal elements in its row. This concept is crucial in the video as it is a necessary condition for the convergence of the Jacobi iteration method. Gamana provides an example to illustrate how to check if a matrix is diagonally dominant.

πŸ’‘Matrix Form

In the video, the matrix form refers to the representation of a system of linear equations as a matrix equation, Ax = b, where A is the coefficient matrix, x is the column vector of variables, and b is the column vector of constants. This form is essential for applying iterative methods like the Jacobi iteration and is a fundamental concept in linear algebra.

πŸ’‘Relative Error

Relative error is a measure used to determine the accuracy of an approximation compared to an exact value. In the video, Gamana uses the relative error as a stopping criterion for the Jacobi iteration process. The iteration continues until the relative error for each variable is less than a predefined threshold, indicating that the solution has converged to a satisfactory level of accuracy.

πŸ’‘Stopping Criterion

A stopping criterion is a condition that determines when to stop the iterative process in numerical methods. In the context of the video, the stopping criterion is a predefined threshold for the relative error. If the relative error for all variables is below this threshold, the iteration is halted, suggesting that the solution has reached an acceptable level of accuracy.

πŸ’‘VBA (Visual Basic for Applications)

VBA is a programming language used in Microsoft Office applications, including Excel, to automate tasks and perform complex calculations. In the video, Gamana demonstrates how to use VBA to implement the Jacobi iteration method, showcasing how to define variables, create procedures, and use loops for the iterative process. This practical application of VBA is used to solve the system of equations discussed.

πŸ’‘Array

In the video, an array is used in the VBA implementation of the Jacobi iteration to store and manipulate multiple values efficiently. Arrays can be one-dimensional or multi-dimensional and are a fundamental data structure in programming. Gamana explains how to use dynamic arrays in VBA to handle the matrix and vector components of the system of equations, streamlining the iterative process.

πŸ’‘Excel Computation

Excel computation refers to the use of Microsoft Excel for performing calculations, including those involving systems of equations. In the video, Gamana demonstrates how to use Excel to compute the solution to a system of equations using the Jacobi iteration method. This involves using Excel's interface to input data, run the VBA script, and visualize the iterative process and its convergence.

Highlights

Introduction to Chapter 2 on systems of equations and the first topic, Jacobi Iteration.

Explaining the shift from solving a single equation to determining values for multiple variables in a set of equations.

General form of linear algebraic equations and their matrix form representation.

Discussion on advanced algebra topics and iterative methods for solving matrix forms.

Introduction to Jacobi Iteration as a simultaneous correction method.

Explanation of rearranging equations in the same manner as in the fixed point method for Jacobi Iteration.

Convergence criteria for Jacobi Iteration involving diagonally dominant matrices.

Practical example of checking if a matrix is diagonally dominant.

Detailed step-by-step solution of a system of linear equations using Jacobi Iteration.

Stopping criterion for the iterative process set at 0.001.

Manual computation process demonstrating the convergence of the solution.

Iterative calculation with initial guesses and determination of variable values.

Calculation of relative errors and comparison with the stopping criterion.

Refinement of variable values through subsequent iterations.

Final solution and satisfaction of the stopping criterion after 10 iterations.

Introduction to computerized computation using Jacobi Iteration in MS Excel.

Explanation of using arrays in VBA to handle multiple values efficiently.

Demonstration of the iterative process using VBA with input from MS Excel.

Final output of the VBA computation showing convergence and root values.

Transcripts

play00:02

hello good day everyone

play00:04

welcome again this is gabriel gamana on

play00:06

this video we will start the title

play00:08

chapter 2 which is the systems of

play00:10

equation

play00:10

with its first topic the so-called

play00:12

jacobi iteration

play00:14

but before i dive into the topic let me

play00:17

first introduce the chapter itself

play00:19

so let's start in chapter 1 we determine

play00:23

the value of x that satisfies a single

play00:25

equation

play00:26

f of x equals 0. now

play00:29

we will deal with the keys of

play00:31

determining the values of x sub 1

play00:33

x sub 2 up to x sub n that

play00:36

simultaneously satisfies a set of

play00:38

equations

play00:40

such system can be either linear or

play00:42

non-linear

play00:44

the general form of linear algebraic

play00:46

equations is given by the equation

play00:49

while rewriting the equation in matrix

play00:52

form can give us

play00:55

at this of the matrix form using exact

play00:57

solution

play00:58

here are the list of topics that deals

play01:00

with the problem

play01:01

and since these topics are normally

play01:03

discussed in advanced algebra

play01:05

i'm not going to discuss it on this

play01:07

video on the other hand

play01:09

those matrix form can also be solved

play01:11

using iterative methods

play01:13

as shown on this list which will also be

play01:16

discussed in chapter 2

play01:18

under this video series so let's dive

play01:21

into the first topic

play01:22

the jacobi iteration jacobi iteration is

play01:26

a simultaneous correction method

play01:28

where no component of an approximation x

play01:31

sub n

play01:31

is used until all components of x sub n

play01:34

have been computed we are going to

play01:37

rearrange the equation

play01:38

the same way as we do in fixed point

play01:40

method

play01:42

so the jacobi equation for the system of

play01:44

linear equation is

play01:46

i know it looks so technical so let me

play01:49

explain it much easier

play01:51

say if we have a system of equations and

play01:53

we are asked to determine

play01:55

the point of their intersection under

play01:57

jacobi

play01:58

iteration we have to rearrange the

play02:00

equation the same manner

play02:02

as we do in fixed point method then

play02:05

using this equation

play02:06

we will implement the iteration process

play02:08

until we arrive on the convergence

play02:11

speaking of convergence in order for the

play02:14

jacobi iteration to converge

play02:16

the diagonal element must be greater

play02:18

than the off diagonal element

play02:20

such matrix is called diagonally

play02:22

dominant matrix

play02:25

for example we have a matrix and we are

play02:27

asked to check

play02:28

if it is a diagonally dominant matrix

play02:31

for the first row the absolute value of

play02:34

6

play02:35

must be greater than the absolute value

play02:38

of negative

play02:38

2 plus the absolute value of 1

play02:43

as well as for the other rows

play02:49

to deeply understand the principle let's

play02:52

solve a problem

play02:53

find a solution for the system of linear

play02:55

equations below

play02:57

with a stopping criterion of 0.001

play03:00

obviously this is the example i used to

play03:03

test the diagonal dominance of a matrix

play03:05

so the problem will converge using

play03:07

jacobi iteration

play03:10

and before we start the solution let's

play03:12

rearrange the equation as what we did in

play03:14

the fixed point method

play03:18

so x sub n plus one is equals to

play03:22

one over six

play03:25

multiplied by eleven

play03:30

minus negative 2

play03:33

multiplied by y sub n

play03:36

minus z sub n

play03:42

and for y sub n plus 1 that is equals to

play03:47

1 over 7

play03:51

times 5 minus

play03:54

negative 2 multiplied by x sub n

play04:03

minus two multiplied by c sub n

play04:08

and for z sub n plus one

play04:12

it is equals to one over

play04:15

negative prime

play04:18

multiplied by minus one

play04:24

minus x sub n

play04:29

minus 2 multiplied by y and n

play04:38

using these equations we can now

play04:39

determine the defined value of the

play04:41

variables

play04:44

let's set this area as the number of

play04:47

iteration

play04:54

the value of x sub n

play04:58

the value of y sub n and the value of z

play05:01

sub n

play05:04

to start the solution let's have an

play05:06

initial guesses of

play05:07

negative prime four

play05:10

negative three under the first iteration

play05:14

then immediately let's determine the

play05:16

defined value of the variables

play05:18

so x sub n plus one is equals to

play05:22

one over six times eleven

play05:26

plus two multiplied by negative four

play05:32

minus negative three

play05:38

[Music]

play05:40

and that is equals to one

play05:45

for y sub n plus one that is equals to

play05:49

one over seven multiplied by five

play05:58

plus two times negative five

play06:04

minus 2 times negative 3

play06:10

and that is equals to

play06:12

[Music]

play06:15

0.143

play06:17

for x of n plus 1 that is equals to one

play06:22

over negative five

play06:26

times negative one

play06:30

minus one

play06:33

times negative time

play06:37

minus two times negative four

play06:45

and that is equals to negative 2.4

play06:49

[Music]

play06:52

and for the relative error epsilon sub x

play06:56

is equal to the absolute value of 1

play07:00

minus negative five

play07:03

all over one

play07:08

and that is equals to six which is

play07:11

greater than

play07:12

the stop in criterion

play07:19

for epsilon sub y

play07:23

that is equal to the absolute value of

play07:25

0.143

play07:29

minus negative four

play07:32

all over zero point

play07:36

one four three

play07:44

that is equals to 29

play07:47

which is greater than the stopping

play07:48

criterion

play07:55

well epsilon sub z is equals to

play07:59

negative 2.4

play08:05

minus negative 3

play08:10

all over

play08:13

negative 2.4

play08:17

absolute value and that is equals to

play08:22

0.25 which is also greater than

play08:26

the stepping 3 billion since all the

play08:29

relative errors are greater than the

play08:31

staffing criterion

play08:32

we will proceed the solution

play08:39

for the second iteration the refined

play08:42

value of the limits will become

play08:45

1 0.143

play08:49

and negative 2.4

play08:52

then immediately let's determine the

play08:55

defined value of the variables

play08:58

so x sub n plus 1

play09:02

is equals to 1 over 6

play09:06

multiplied by eleven plus two

play09:10

times zero point one fourteen

play09:14

minus negative two point four

play09:22

that is equals to two point

play09:26

two eight one

play09:33

for y sub n plus one

play09:36

that is equals to one over seven

play09:40

multiplied by five plus two

play09:44

times one

play09:48

minus two multiplied by

play09:51

negative two point four

play09:54

and that is equals to

play09:58

one point six eight six

play10:04

well for z sub n plus one

play10:08

that is equals to one over negative five

play10:12

multiplied by negative one

play10:15

minus one minus

play10:18

2 multiplied by 0.143

play10:29

and that is equals to 0.457

play10:38

for the relative error

play10:41

epsilon sub x is equals to 2.281

play10:48

minus 1 all over

play10:53

2.281

play10:54

[Music]

play10:57

absolute value that is equal to 0.562

play11:04

greater than the stopping criterion

play11:11

for the epsilon sub y

play11:16

that is equals to 1.686

play11:23

minus 0.143

play11:29

all over 1.686

play11:34

absolute value and that is equals to

play11:40

0.915

play11:45

greater than the stopping criterion and

play11:48

for the epsilon sub z

play11:52

that is equals to zero point

play11:56

four times seven

play12:01

minus negative two point four

play12:06

all over zero point

play12:13

absolute value that is equals to

play12:16

[Music]

play12:17

6.25

play12:20

still greater than the stopping

play12:22

criterion

play12:24

since all of the relative errors are

play12:25

greater than the stopping criterion

play12:28

we will proceed the solution so for the

play12:30

third iteration

play12:32

the refined value of the limits will

play12:34

become

play12:36

2.281

play12:40

1.686

play12:42

[Music]

play12:44

and 0.457

play12:50

well now i suppose that you now

play12:51

understand how to determine

play12:53

the point that satisfies simultaneously

play12:56

the equations

play12:57

using jacobi iteration so let me now

play13:00

show you my ms excel computation that

play13:03

presents the convergence of the solution

play13:05

as you seen it took 10 iterations

play13:08

satisfy the stopping criterion

play13:10

with the point value of 2

play13:13

1 and 1. it means that this equation

play13:17

will simultaneously satisfy

play13:19

with the said coordinates so that

play13:21

concludes the discussion

play13:23

of the manual computation using jacobi

play13:25

iteration

play13:27

this last part of the video is for the

play13:29

computerized competition using jacobi

play13:31

iteration

play13:32

again insert another module for our new

play13:35

method

play13:36

and rename it as jacobi iteration

play13:40

then create a sub procedure and name it

play13:42

as jacobi

play13:45

then let's define the variable and their

play13:47

variable types

play13:48

this time we will use a variable that

play13:50

contains more than one value

play13:52

the so-called array array is a

play13:55

multi-dimensional function that contains

play13:57

a vast amount of information

play13:59

so instead of using hundreds of

play14:00

variables

play14:02

we will now use a single array that can

play14:04

contain hundreds of information or even

play14:06

thousands

play14:08

well to make it simple the variables

play14:11

that we defined earlier as a string

play14:13

integers and double can contain only one

play14:17

value

play14:18

like the letter a on this equation while

play14:21

array on the other hand is a matrix of

play14:23

information

play14:24

it can be one dimensional or

play14:26

multi-dimensional

play14:28

so this type of array is called dynamic

play14:30

array

play14:31

since the size is not yet determined due

play14:33

to the fact that the problems

play14:35

have different matrix sizes instead of

play14:38

putting the content

play14:39

of matrix one by one inside the vba

play14:42

we will use input box and we'll just

play14:45

select

play14:46

the content of the matrix within ms

play14:48

excel

play14:49

then using u-bound function we will

play14:53

determine the size of the matrix

play14:56

and using the redeem function we will

play14:58

now specify the size of the matrix

play15:00

which is left blank before the selection

play15:02

of the matrix info

play15:03

[Music]

play15:04

for the iterative process we will use a

play15:08

series of do until loops

play15:10

where this line is for the summation

play15:12

part of the jacobi iteration equation

play15:14

or in simple word the coefficient times

play15:17

the variables

play15:18

while this line over here is the full

play15:21

equation

play15:22

object of the iteration while the setup

play15:26

lines will repeat the process in other

play15:28

equations

play15:31

i just want to highlight that to extract

play15:33

the maximum content of this array

play15:36

we will use worksheet function

play15:39

and to present the output of vba after

play15:41

satisfying the inheritance process

play15:44

we will use do until the since we have

play15:46

three different

play15:47

outputs with the aid of a message box

play15:51

so if i run the code by pressing f5 it

play15:54

will ask me

play15:55

to select the coefficient matrix

play15:58

[Music]

play15:59

as well as the constant matrix

play16:04

the initial values

play16:08

and this typing criterion

play16:12

and by clicking ok the code has a first

play16:15

output of

play16:16

10 iterations with a root value of 2 and

play16:19

a relative error of 0.00297

play16:24

for the second iteration 10 iterations

play16:27

with root value of 1

play16:28

with a relative error of 0.000405

play16:32

for third output 10 iterations with root

play16:35

value

play16:36

of 1 and a relative error of 0 0 0

play16:39

934 so that's it for this video

play16:43

hopefully you learned something new

play16:45

thank you for watching and see you soon

play16:48

keep safe guys

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Jacobi IterationSystems of EquationsNumerical MethodsLinear AlgebraExcel TutorialAlgorithm ImplementationConvergence AnalysisDiagonally DominantVBA ProgrammingIterative Solutions