Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Finally, consider the following fixed point iteration xk+1 = g(xk) = arccos (1/ 1 + e^2x) and show that finding a fixed point of g(x)

Finally, consider the following fixed point iteration xk+1 = g(xk) = arccos (1/ 1 + e^2x) and show that finding a fixed point of g(x) is equivalent to finding a root of f(x) = 0. Use the code fixedpt.m to try to approximate the root using an initial guess of x0 = 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] )' ); end if 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; end xfinal = xnew;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions