Last active
September 29, 2016 10:22
-
-
Save dretax/e9de2e208659dfc8825f7f095798f7a3 to your computer and use it in GitHub Desktop.
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
format long | |
itt = 10000000; | |
leib = 1; | |
for i=3:4:itt | |
leib = leib - (1.0 / i) + (1.0 / (i + 2)); | |
end | |
disp('Calc: ') | |
leib = leib*4 | |
disp('Pi: ') | |
pi | |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
x=[0:0.001:1]; | |
y= 1./(1+x.^2); | |
plot(x,y) | |
xlim([ 0 1]); | |
ylim([0 1.1]); | |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
format long | |
iter = 10000000; | |
x = 0; | |
width = 1 /iter; | |
fter = 0; | |
for i = 0:iter | |
x = (i + 0.5) *width; | |
fter = fter + 4 / (1 + x * x); | |
end | |
disp('1/(1+n^2) alatti ferület: ') | |
fter*width | |
disp('Pi: ') | |
pi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment