Cody

Problem 44159. calculate PI without using pi function

Solution 1497457

Submitted on 19 Apr 2018 by Gareth Lee
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
assert(abs(calculate_PAI-pi)<1e-7);

ans = 3.1416

2   Pass
filetext = fileread('calculate_PAI.m'); assert(isempty(strfind(filetext, 'pi')),'pi forbidden'); assert(isempty(strfind(filetext, '3.14159')),'3.14159 forbidden'); assert(isempty(strfind(filetext, 'str')),'str function forbidden');

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!