Problem 42823. Babylonian method

Solution 1568445

Submitted on 24 Jun 2018 by bainhome
  • Size: 24
  • This is the leading solution.
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
a=1; n=1; y_correct=1; assert(abs(Babylonian(a,n)-y_correct)<0.001);

2   Pass
a=10; n=1; y_correct=1; assert(abs(Babylonian(a,n)-y_correct)<0.001);

3   Pass
a=2; n=10; y_correct=1.4142; assert(abs(Babylonian(a,n)-y_correct)<0.001);

4   Pass
a=4; n=10; y_correct=2; assert(abs(Babylonian(a,n)-y_correct)<0.001);

5   Pass
a=0.25; n=10; y_correct=0.5; assert(abs(Babylonian(a,n)-y_correct)<0.001);

6   Pass
a=30; n=4; y_correct=6.0795; assert(abs(Babylonian(a,n)-y_correct)<0.001);

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!