Madhava approximation of pi
이전 댓글 표시
I am trying to approximate the value of pi using the equation Madahava of Sangamagrama used.
The code that I have so far is:
function [ output_args ] = madhavapi(m)
%This function will takes N as input and returns an approximation for pi.
k=[0 1 2 3 4]
1./(-3).k
[1/(-3)^0/(-3)^1/(-3)^2;
1./(2.*k-1)
1./sum*12
end
I am not sure how to conclude this code. When I try to execute the above code, I do not get any answer.
댓글 수: 3
Marc
2013년 10월 26일
Wasn't Madahava Sangamagrama a wizard in The Lord of the Rings?
KayLynn
2013년 10월 26일
Walter Roberson
2013년 10월 26일
편집: Walter Roberson
2013년 10월 26일
You did not assign anything to "output_args"
"sum" is a function, not a variable.
You do not use "m" anywhere in your function.
The expression
1./(-3).k
is not valid. There is no "." operator in MATLAB.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Vector Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!