00:01
Okay, we have an equation for the value of pi and we want to try it for a whole bunch of terms, everything from 10 ,000 terms all the way up to 100 ,000 terms in increments of 10 ,000.
00:16
And so let's calculate the stuff in parentheses first.
00:21
And i'm just going to call that answer.
00:23
It's not the total answer that pi is.
00:26
And i'm going to call that 0 .0 because i want that to be a floating point value.
00:30
You and then i'm going to build a first four loop and i'm just going to use it value and i'm going to say in range and i'm going to start off with 10 ,000 because that's where i want to start i want to go to a hundred thousand so i'll write a hundred thousand and one and then i want to increment by ten thousands and so i suppose you could do a hundred thousand and fifty if you want it doesn't have to be 100 ,0001, but that's the smallest value that you need there.
01:13
And then we're going to be using an equation with a variable in it.
01:22
And so i'm going to say another four loop for i'll call it i in range.
01:34
And i'm going to go from one to value.
01:38
And so right here i'm to say value plus one so that we end up at value.
01:45
So if value's 10 ,000, that's going to give me 1 to 10 ,000.
01:50
And then what i'm going to do is i need to use floating point numbers in order to get this to work.
01:55
So i'm just going to convert that i, that integer i to a floating point and call it x and use the x in the equation.
02:07
And so now i'm going to do answer.
02:09
And i'm going to increment.
02:11
Because we're summing over all of those terms.
02:16
And the first piece i want is i'm going to do minus 1 raised to the x plus 1 power.
02:32
And that's what that part is right there.
02:36
And that is what's on the top of the fraction.
02:41
Make sure i got that all right.
02:43
I did.
02:44
And then i'm going to divide that by.
02:52
2x minus 1...