Last active
August 29, 2015 14:06
-
-
Save 0V/2094f20c9bc6870f4762 to your computer and use it in GitHub Desktop.
Wallis' Formula by Matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count = 計算回数 | |
# precision = 精度 | |
function y = wallis_formula(count,precision) | |
output_precision(precision) | |
i = 1 | |
a = 1 | |
while(i<=count) | |
num = 4*(i^2) | |
a = a * num/(num-1) | |
i++ | |
end | |
y = a * 2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment