# hw307 - 2.2 4 FIXED POINT ITERATION CODE i = 1 N = 100 p0 =...

This preview shows pages 1–3. Sign up to view the full content.

2.2 4. FIXED POINT ITERATION CODE i = 1; N = 100; p0 = 1; tol = 1.e-2; while i <= N p = g(p0); if abs(p-p0) < tol disp( 'The procedure was successful after k iterations' ) k = i disp( 'The root to the equation is' ) p return end i = i+1; p0 = p; end disp( 'Method Failed after N iterations' ) N a) Method Failed after N iterations N = 100 b) Method Failed after N iterations N = 100 c) The procedure was successful after k iterations k = 6 The root to the equation is p = 1.4758 d) The procedure was successful after k iterations k = 67 The root to the equation is p = 1.4806 5. function y = g(x)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
y =(3*x^2+3)^(1/4); The procedure was successful after k iterations k = 6 The root to the equation is p = 1.9433 6. a) function y = g(x) y =x-(exp(x)+2^(-x)+2*cos(x)-6)/(-2*log(2)*2^(-x)-2*sin(x)+exp(x)); The procedure was successful after k iterations k = 10 The root to the equation is p = 1.8494 b) function y = g(x) y = x-(log(x-1)+cos(x-1))/(1/(x-1)-sin(x-1)); The procedure was successful after k iterations
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/01/2009 for the course PSTAT 120A taught by Professor Mackgalloway during the Spring '08 term at UCSB.

### Page1 / 6

hw307 - 2.2 4 FIXED POINT ITERATION CODE i = 1 N = 100 p0 =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online