Cody

Solution 1644254

Submitted on 12 Oct 2018 by Rafael Hernandez-Walls
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x_fixed_point = fixed_point(@(x) 2./(2*x+1),0,5) assert(abs(0.8923-x_fixed_point)<1e-4)

x0 = 2 x0 = 0.4000 x0 = 1.1111 x0 = 0.6207 x0 = 0.8923 x_fixed_point = 0.8923

2   Pass
x_fixed_point = fixed_point(@(x) 2./(2*x+1),0,20) assert(abs(0.7807-x_fixed_point)<1e-4)

x0 = 2 x0 = 0.4000 x0 = 1.1111 x0 = 0.6207 x0 = 0.8923 x0 = 0.7182 x0 = 0.8209 x0 = 0.7571 x0 = 0.7955 x0 = 0.7719 x0 = 0.7862 x0 = 0.7775 x0 = 0.7828 x0 = 0.7795 x0 = 0.7815 x0 = 0.7803 x0 = 0.7811 x0 = 0.7806 x0 = 0.7809 x0 = 0.7807 x_fixed_point = 0.7807

3   Pass
x_fixed_point = fixed_point(@(x) exp(-x),0,2) assert(abs(0.3679-x_fixed_point)<1e-4)

x0 = 1 x0 = 0.3679 x_fixed_point = 0.3679

4   Pass
x_fixed_point = fixed_point(@(x) exp(-x),0,10) assert(abs(0.5649-x_fixed_point)<1e-4)

x0 = 1 x0 = 0.3679 x0 = 0.6922 x0 = 0.5005 x0 = 0.6062 x0 = 0.5454 x0 = 0.5796 x0 = 0.5601 x0 = 0.5711 x0 = 0.5649 x_fixed_point = 0.5649