Bracketing Methods Tut 3 Numerical
Bracketing Methods Tut 3 Numerical
1. Initialize:
o Compute f(c)f(c)f(c)
2. Iterate:
MATLAB Implementation
function bisection_method()
f = @(x) -x^2 + 1.8*x + 2.5; % Define the function
a = 0; b = 2; % Initial interval
epsilon_s = 0.05; % Desired stopping criterion
tol = inf; % Initialize tolerance
iteration = 0;
1. Initialize:
2. Iterate:
o Compute f(c)f(c)f(c) and update the interval based on the sign of f(c)f(c)f(c).
o Continue until the approximate error ϵa<ϵs\epsilon_a < \epsilon_sϵa<ϵs.
MATLAB Implementation
function false_position_method()
f = @(x) -x^2 + 1.8*x + 2.5; % Define the function
a = 0; b = 2; % Initial interval
epsilon_s = 0.05; % Desired stopping criterion
tol = inf; % Initialize tolerance
iteration = 0;