]> gitweb.michael.orlitzky.com - octave.git/blob - tests/fixed_point_method_tests.m
Add is_positive_definite() and its tests.
[octave.git] / tests / fixed_point_method_tests.m
1 g = @(x) 1 + atan(x);
2 expected_fp = 2.1323;
3 tol = 1 / 10^10;
4 x0 = 2.4;
5 unit_test_equals("Homework #2 problem #5 fixed point is correct", ...
6 expected_fp, ...
7 fixed_point_method(g, tol, x0));
8
9
10 h = 0.5;
11 g1 = @(u) 1 + h*exp(-u(1)^2)/(1+u(2)^2);
12 g2 = @(u) 0.5 + h*atan(u(1)^2 + u(2)^2);
13 my_g = @(u) [g1(u), g2(u)];
14 tol = 1 / 10^9;
15 u0 = [1,1];
16 expected_fp = [1.0729, 1.0821];
17 unit_test_equals("Homework #3 problem #3i fixed point is correct", ...
18 expected_fp, ...
19 fixed_point_method(my_g, tol, u0));