Skip to content

Commit 6f77c1b

Browse files
committed
added check for perfect initial guess, updated documentation
1 parent 63b4a85 commit 6f77c1b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

EXAMPLES.mlx

4.01 KB
Binary file not shown.

Root_Finding_Methods.pdf

5.56 KB
Binary file not shown.

fixed_point_iteration.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
% [c,k,c_all] = fixed_point_iteration(__)
1010
%
1111
% Copyright © 2021 Tamas Kis
12-
% Last Update: 2022-07-06
12+
% Last Update: 2022-10-16
1313
% Website: https://tamaskis.github.io
1414
% Contact: tamas.a.kis@outlook.com
1515
%
@@ -70,6 +70,12 @@
7070
% Fixed-point iteration.
7171
% ----------------------
7272

73+
% returns initial guess if it is a fixed point of f(x)
74+
if f(x0) == x0
75+
c = x0;
76+
return
77+
end
78+
7379
% fixed point estimate at first iteration
7480
x_curr = x0;
7581

@@ -78,7 +84,7 @@
7884
c_all = zeros(1,k_max+1);
7985
end
8086

81-
% fixed-point iteration
87+
% iteration
8288
for k = 1:k_max
8389

8490
% stores results in arrays

0 commit comments

Comments
 (0)