Finally, consider the following fixed point iteration xk+1 = g(xk) = arccos −1 1 + e...

50.1K

Verified Solution

Question

Advance Math

Finally, consider the following fixed point iteration xk+1 =g(xk) = arccos −1 1 + e 2x and show that finding a fixed point ofg(x) is equivalent to finding a root of f(x) = 0. Use the codefixedpt.m to try to approximate the root using an initial guess ofx0 = −3. Can you explain why your iteration behaves as it does?Hint: Plot the fixed-point function and think convergence!

Code in fixedpt.m:-

function [xfinal, niter, xlist] = fixedpt( gfunc, xguess, tol )% FIXEDPT: Fixed point iteration for x=gfunc(x).%% Sample usage:%   [xfinal, niter, xlist] = fixedpt( gfunc, xguess, tol )%% Input:%   gfunc  - fixed point function %   xguess - initial guess at the fixed point%   tol   - convergence tolerance (OPTIONAL, defaults to 1e-6)%% Output:%   xfinal - final estimate of the fixed point%   niter  - number of iterations to convergence%   xlist  - list of interates, an array of length 'niter'% First, do some error checking on parameters.if nargin < 2 fprintf( 1, 'FIXEDPT: must be called with at least two arguments' ); error( 'Usage: [xfinal, niter, xlist] = fixedpt( gfunc, xguess, [tol] )' );endif nargin < 3, tol = 1e-6; end% fcnchk(...) allows a string function to be sent as a parameter, and% coverts it to the correct type to allow evaluation by feval().gfunc = fcnchk(gfunc);x = xguess;xlist = [ x ];niter = 0;done = 0;while ~done, xnew = feval(gfunc, x); xlist = [ xlist; xnew ]; % create a list of x-values  niter = niter + 1; if abs(x-xnew) < tol,   % stopping tolerance for x only  done = 1; end x = xnew;endxfinal = xnew;

Answer & Explanation Solved by verified expert
4.2 Ratings (894 Votes)
clcclear allclose allformat longgx acos11exp2xxfinal niter xlist fixedpt g 31e6fplotg33function xfinal niter xlist fixedpt gfunc xguess tol FIXEDPT Fixed point iteration for xgfuncx Sample usage xfinal    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students