Skip to content

Instantly share code, notes, and snippets.

@0V
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0V/2094f20c9bc6870f4762 to your computer and use it in GitHub Desktop.
Save 0V/2094f20c9bc6870f4762 to your computer and use it in GitHub Desktop.
Wallis' Formula by Matlab
# 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