Madhava approximation of pi
Mostra commenti meno recenti
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 Commenti
Marc
il 26 Ott 2013
Wasn't Madahava Sangamagrama a wizard in The Lord of the Rings?
KayLynn
il 26 Ott 2013
Walter Roberson
il 26 Ott 2013
Modificato: Walter Roberson
il 26 Ott 2013
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.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Vector Data in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!