# Question (from Gilat and Subramanian) In the Regula Falsi search te...

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

function [x,Emaxs] = crude (f, xL, xU, Edes, display)
% CUDE Finds a minimum by performing a bisection like search
% Inputs: f = a function of one variable
%         xL = lower bound of region containing minimum
%         xU = upper bound of region containing minimum
%         Edes = function stops when x is guaranteed within Edes of minimum
%         display = display option (0 = no display (default), 1 = display)
% Outputs: x - estimate of minimum
%          Emaxs - value of Emax as a function of iteration number k;
if nargin < 5; display = 0; end

if display
fprintf ...
('    N       xL          xA          xB          xU          Emax\n');
end

functionCount = 0;

for k = 0 : 1000

Emax = (xU - xL) / 2;
Emaxs(k+1)=Emax;

xA = xL + 0.49 * (xU - xL); fxA = f(xA);
xB = xL + 0.51 * (xU - xL); fxB = f(xB);
functionCount = functionCount + 2;

if display
fprintf ('%5d %12.6f %12.6f %12.6f %12.6f %12.6f\n', ...
k, xL, xA, xB, xU, Emax);
end

if Emax <= Edes
x = (xL + xU) / 2; % take midpoint as final answer
if display
% the last two function evaluations weren't actually needed
% (the results weren't used) and could be eliminated
fprintf ('Tolerance achieved after %d function evaluations.\n', ...
functionCount - 2);
end...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$30.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Mathematics - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.