Cody

Problem 1890. Fixed-Point Iteration

Solution 1644250

Submitted on 12 Oct 2018
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   Fail
x_fixed_point = fixed_point(@(x) 2./(2*x+1),0,5) assert(abs(0.8923-x_fixed_point)<1e-4)

x_fixed_point = 0.7808

Assertion failed.

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

x_fixed_point = 0.7808

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

x_fixed_point = 0.5671

Assertion failed.

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

x_fixed_point = 0.5671

Assertion failed.