0% found this document useful (0 votes)
2 views8 pages

Seatwork-2

The document outlines various numerical methods for solving equations, including the Bisection Method, Regula-Falsi, Secant Method, Newton-Raphson Method, and Gauss methods. Each method is explained with iterative formulas, sample problems, and step-by-step instructions to reach a solution. Additionally, tables are provided for tracking iterations and results for each method.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Seatwork-2

The document outlines various numerical methods for solving equations, including the Bisection Method, Regula-Falsi, Secant Method, Newton-Raphson Method, and Gauss methods. Each method is explained with iterative formulas, sample problems, and step-by-step instructions to reach a solution. Additionally, tables are provided for tracking iterations and results for each method.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Bisection Method

Iterative Formula:

Xnew = (Xn + Xp) / 2

Sample Problem:

f(x) = x3 + 5x2 + 7x – 20
Use initial value of (1,2). Stop if you reach 5 iterations.

Steps to solve a problem using Bisection method

1. If no initial value to be used is given, find two values of x (xp and xn) where xp would result in a
positive value for f(xp) and xn would result in a negative value for f(xn). (THIS STEP WILL BE
USED ONLY IF AN INTIAL VALUE IS NOT GIVEN)

2. If an initial value is given, solve for f(x) for the two values given. Assign the initial value of x with
a positive function to xp and assign the initial value of x with a negative function to xn.

Applying to the given problem,


Substitute x=1 to the given equation. Solve for f(1). f(1) = -7
Substitute x=2 to the given equation. Solve for f(2). f(2) = 22
Since f(1) is negative and f(2) is positive, assign xn=1 and xp =2

3. Compute for xnew using the iterative formula. After solving xnew, solve for fxnew.

Applying to the given problem,


Xnew = (1 + 2) / 2; xnew = 1.5 f(xnew)=5.125

4. Depending on the sign of fxnew, assign to xnew to either xn or xp. The condition is, if fxnew is
positive, assign xnew to xp. Otherwise, if fxnew is negative, assign fxnew to xn. Take note, we are
checking the sign of fxnew to determine where to assign the value of xnew in the next iteration. If you
assign the value of xnew to xn, retain the value of xp from the previous iteration. If you assign the value
of xnew to xp, retain the value of xn from the previous iteration. Solve for the new value of xnew and
fxnew as stated in step 3. Continue doing the process until you reach any of the the following condition:
a. The computed value of fxnew is already zero (0), it means you have the exact value for
the unknow.
b. The previous value of xnew is the same the the current compute value of xnew.
c. If you reached the maximum number of iterations stated in the problem.

Applying to the given problem,


For the next iteration, since the computed value for f(xnew) is positive, we will assign xnew to xp
and retain the value of xn. Continue steps 3 and 4 until you reach 5 iterations as stated in the
problem. Take note of the number of decimal places to be rounded off. Apply the rules I have
given you from the previous meeting. Completely fill out the table below.
Table for Bisection Method

Xn fxn xp fxp xnew fxnew


1.000 -7.000 2.000 22.000 1.500 5.125
1.000 -7.000 1.500 5.125

Regula-Falsi
Iterative Formula:

Xnew = xp - [(f(xp) * (xp – xn)) / (f(xp) – f(xn))]

Sample Problem:

f(x) = x3 + 5x2 + 7x – 20
Use initial value of (1,2). Stop if you reach 5 iterations.

Steps to solve a problem using Regula-Falsi method

1. If no initial value to be used is given, find two values of x (xp and xn) where xp would result in a
positive value for f(xp) and xn would result in a negative value for f(xn). (THIS STEP WILL BE
USED ONLY IF AN INTIAL VALUE IS NOT GIVEN)

2. If an initial value is given, solve for f(x) for the two values given. Assign the initial value of x with
a positive function to xp and assign the initial value of x with a negative function to xn.

Applying to the given problem,


Substitute x=1 to the given equation. Solve for f(1). f(1) = -7
Substitute x=2 to the given equation. Solve for f(2). f(2) = 22
Since f(1) is negative and f(2) is positive, assign xn=1 and xp =2

3. Compute for xnew using the iterative formula. After solving xnew, solve for fxnew.

Applying to the given problem,


Xnew = 2 – [((22)*(2-1))/(22-(-7))]; xnew = 1.241 f(xnew)=-1.701

4. Depending on the sign of fxnew, assign to xnew to either xn or xp. The condition is, if fxnew is
positive, assign xnew to xp. Otherwise, if fxnew is negative, assign fxnew to xn. Take note, we are
checking the sign of fxnew to determine where to assign the value of xnew in the next iteration. If you
assign the value of xnew to xn, retain the value of xp from the previous iteration. If you assign the value
of xnew to xp, retain the value of xn from the previous iteration. Solve for the new value of xnew and
fxnew as stated in step 3. Continue doing the process until you reach any of the the following condition:
a. The computed value of fxnew is already zero (0), it means you have the exact value for
the unknow.
b. The previous value of xnew is the same the the current compute value of xnew.
c. If you reached the maximum number of iterations stated in the problem.

Applying to the given problem,

For the next iteration, since the computed value for f(xnew) is negative, we will assign xnew to xn and
retain the value of xp. Continue steps 3 and 4 until you reach 5 iterations as stated in the problem.
Take note of the number of decimal places to be rounded off. Apply the rules I have given you from the
previous meeting. Completely fill out the table below.

Table for Regula-Falsi

Xn fxn xp fxp xnew fxnew


1.000 -7.000 2.000 22.000 1.241 -1.701
1.241 -1.701 2.000 22.000

Secant Method
Iterative Formula:

Xnew = x1 - [(f(x1) * (x1 – x0)) / (f(x1) – f(x0))]

Sample Problem:

f(x) = x3 + 5x2 + 7x – 20
Use initial value of (1,2). Stop if you reach 5 iterations.

Steps to solve a problem using Secant method

1. If no initial value to be used is given, assign any two different values of x. (THIS STEP WILL BE
USED ONLY IF AN INTIAL VALUE IS NOT GIVEN)

2. If an initial value is given, assign immediately the first value to x0 and second value to x1.
Compute for f(x0) and f(x1) using the initial values (x0,x1).

Applying to the given problem, since the intial values are (1,2),
Assign x0 = 1 and x1 = 2.
Compute for f(x0) and f(x1)
f(x0)=-7 and f(x1)=22.
3. Compute for xnew using the iterative formula. After solving xnew, solve for fxnew.

Applying to the given problem,


Xnew = 2 – [((22)*(2-1))/(22-(-7))]; xnew = 1.241 f(xnew)= -1.701

4. For the next iteration, immediately assign previous value of x1 to present value of x0, previous
value of xnew to present value of x1. Solve for the new value of xnew and fxnew as stated in step 3.
Continue doing the process until you reach any of the the following condition:
a. The computed value of fxnew is already zero (0), it means you have the exact value for
the unknow.
b. The previous value of xnew is the same the the current compute value of xnew.
c. If you reached the maximum number of iterations stated in the problem.

Applying to the given problem,

For the next iteration, immediately assign to x0 the previous value of x1 (x0 =2), assign xnew of the
previous iteration to x1 (x1= 1.241), compute/copy the corresponding functions for x0 and x1. Continue
steps 3 and 4 until you reach 5 iterations as stated in the problem. Take note of the number of decimal
places to be rounded off. Apply the rules I have given you from the previous meeting. Completely fill
out the table below.

Table for Secant Method

X0 Fx0 X1 Fx1 xnew fxnew


1.000 -7.000 2.000 22.000 1.241 -1.701
2.000 22.000 1.241 -1.701

Newton Raphson Method


Iterative Formula:

Xnew = X – [f(x) / f’(x)]

f(x) = x3 + 5x2 + 7x – 20
Use initial value of (1). Stop if you reach 5 iterations.

Steps to solve a problem using Secant method


1. If no initial value to be used is given, assign any value of x. (THIS STEP WILL BE USED ONLY IF AN
INTIAL VALUE IS NOT GIVEN)

2. If an initial value is given, solve for the f(x) and the first derivative of the function f’(x) and
eventually xnew and fxnew.

Applying to the given problem,


Solving for f’(x), we will arrive with the equation f’(x) = 3*x2 + 10*x + 7
Assign the given initial value of x = 1 and solve for f(x) and f’(x)
Computing for f(x) and f’(x)
f(1)=-7 and f’(1)=20.

3. Compute for xnew using the iterative formula. After solving xnew, solve for fxnew.

Applying to the given problem,


Xnew =1 – (-7/20); xnew = 1.350 f(xnew)= 1.023

4. For the next iteration, immediately assign to x the value of xnew from previous iteration. Solve
for f(x) and f’(x) of the present iteration. Solve for the new value of xnew and fxnew as stated in step 3.
Continue doing the process until you reach any of the the following condition:
a. The computed value of fxnew is already zero (0), it means you have the exact value for
the unknow.
b. The previous value of xnew is the same the the current compute value of xnew.
c. If you reached the maximum number of iterations stated in the problem.

Applying to the given problem,

For the next iteration, immediately assign to x the previous value of xnew (x =1.35), solve for f(x) and
f’(x) which results to f(1.35) = 1.023 and f’(1.35) = 25.968. Continue steps 3 and 4 until you reach 5
iterations as stated in the problem. Take note of the number of decimal places to be rounded off. Apply
the rules I have given you from the previous meeting. Completely fill out the table below.

Table for Newton Raphson Method

x fx f’x xnew fxnew


1.000 -7.000 20.000 1.350 1.023
1.350 1.023 25.968
Gauss Jacobi and Gauss Seidel

Sample Problem:

4x1 + 22x2 – 13x3 = -128

19x1 – 13x2 + 4x3 = 111

8x1 + 8x2 + 17x3 = 10

Use (0,0,0) as your initial value. Round off up to 3 decimal places.

For the both Gauss Jacobi and Gauss Seidel, the initial steps are the same. The following are the rules in
using Gauss Jacobi and Gauss Seidel to solve a given problem.

1. Arrange the equations in such a way that the diagonal is dominant. Meaning, it has the
greatest coefficient value (irregardless of sign  absolute value of each coefficient) in each
equations x1, x2 and x3’s coefficient. Please see illustration below.

The equations must be arrange in such a way that a11, a22 and ann have the dominant values. An
arrangement can be called as a strictly diagonally dominant if it would satisfy the given condition:

|a11| > |a12| + … + |a1n|; |a22| > |a21| + … + |a2n|; … ; |ann| > |an1| + … + |an(n-1)|;

A strictly diagonally dominant equation would result in a much higher chance of convergence. A
diagonally dominant equation would result in a lower change of convergence or no convergence at all.

Applying to the given problem, the equations must be arrange in the following order:

19x1 – 13x2 + 4x3 = 111; 19 > 13 + 4

4x1 + 22x2 – 13x3 = -128; 22 > 4 + 13

8x1 + 8x2 + 17x3 = 10; 17 > 8 + 8

2. Next step is isolate each unknown that comes together with the dominant value.
x1 = (b1 – a12x2 - … - a1nxn) / a11
x2 = (b2 – a21x1 - … - a2nxn) / a22
xn = (bn – an1x1 - … - an(n-1)x(n-1)) / ann

Applying in the given problem, the iterative formula will result to the following equations:

x1 = (111 + 13x2 – 4x3) / 19

x2 = (-128 – 4x1 + 13x3) / 22

x3 = (10 - 8x1 – 8x2) / 17

The following steps will show how the two methods will differ:
For Gauss Jacobi, use the given initial values to solve for the first iteration. Solve for x1, x2 and x3 using
(0,0,0) as the value of the unknows in the right side of the equation.

x1 = (111 + 13(0) – 4(0)) / 19 = 5.842

x2 = (-128 – 4(0) + 13(0)) / 22 = -5.818

x3 = (10 - 8(0) – 8(0)) / 17 = 0.588

for the 2nd iterations, use the values from the 1st iteration to solve for x1, x2 and x3. Fill out the table
below.

Table for Gauss Jacobi

iterations x1 x2 x3

initial value 0 0 0

1st 5.842 -5.818 0.588

2nd

3rd

4th

5th

For Gauss Seidel,

For the 1st iteration,


use the given initial values to solve for the x1,
use the initial value of x3 and the value of x1 in the 1st iteration to solve for x2.
use the value of x1 in the 1st iteration and the value of x2 in the 1st iteration to solve for x3.
In short, you use the latest value of the computed variable in solving for the current unknown.
x1 = (111 + 13(0) – 4(0)) / 19 = 5.842

x2 = (-128 – 4(5.842) + 13(0)) / 22 = -6.880

x3 = (10 - 8(5.842) – 8(-6.880)) / 17 = 1.077

for the 2nd iteration, use the latest value for each computed unknows. Fill out the table below.

Table for Gauss Seidel

iterations x1 x2 x3

initial value 0 0 0

1st 5.842 -6.880 1.077

2nd

3rd

4th

5th

You might also like