(c) Since π/4 = arctan, you can find the value of π/4 using your expansion. How many terms of the expansion would you have to add in order to obtain π correct to four decimal places?
I got the Maclaurin series for arctan(x) = \[\sum_{n=0}^{\inf} \dfrac{ (-1^n)x^{2n+1} }{ 2n+1 }\] Since it's alternating, when should the approximation end?
\[x-\frac{ x^3 }{3 } + \frac{ x^5 }{5 } -\frac{ x^7 }{7 } + ...\] how far does this go?
lol, no. I mean if it's alternating you cut off right before the one you don't want to include, right? would that be x^1001/1001?
What do you mean by how far does this go?
the expansion. For approximation
.0001 whoops. Just how much terms I'd have to add up to get an accuracy of .0001
Couldn't we find out what the decimal approximation of pi over four is and then add enough terms of the series to become within .0001 of that value.
oooh I mean arctan 1
Right, so arctan(1) = pi/4
So we can write out a few terms for arctan(x) using the series you noted above and plug in 1 for x.
exactly. \[1 - \frac{ 1 }{ 3 } + \frac{ 1 }{ 5 } - \frac{ 1 }{ 7 } +\frac{ 1 }{ 9 } - \frac{ 1 }{ 11 }+...\] and then what?
We know \[\pi/4 = 0.78539...\] Find the value of n where the absolute value of the difference between the nth partial sum of the series and pi/4 is less than or equal to .0001
I'm admittedly struggling with taking the next step...
It's okay. What we want to do is start calculating each partial sum, like so,\[1-\frac{ 1 }{ 3 } = \frac{ 2 }{ 3}\approx.66666\]\[1-\frac{ 1 }{ 3 } + \frac{ 1 }{ 5 } = \frac{ 2 }{ 3}\ + \frac{ 1 }{ 5}\approx.66666 + .2 = .86666\] \[1-\frac{ 1 }{ 3 } + \frac{ 1 }{ 5 } = \frac{ 13 }{ 15}\ - \frac{ 1 }{ 7}\approx.86666 - .14285 = .72389\] Observe that the more terms we add, the closer we get to the actual value of pi/4. Once we calculate enough terms, some absolute difference of that nth partial sum and the actual value of pi/4 will be less than or equal to .0001
Could I create a program to automate this and see how close I get?
Wow. That's a great question. I'm sure we could. Do you know how to code in c?
I'll use c++ gimme a few minutes. Terribly sorry I'm so slow lol
Great. I'm interested in seeing how accurate you can get it.
I immediately regret this suggestion ... double sum = 0; for(int i=1;i<8;i+=2) { sum += ((pow((-1),i))/(2*i+1)); } ...
is not working
I was going to use some if statements to dictate when to add or subtract.
I was trying something like using a counter "if(counter%2!=0)" but that would not work at all lol
Right that is what i'm trying lol
Mine works Wanna see?
It's in c though. Not too different.
I'll manage with the syntax and whatnot
//pi over 4 approx #include<stdio.h> #include<stdlib.h> #include<math.h.> #define PI_OVER_FOUR 0.78539816339744830961566084581988 int main(){ int ans, i; double sum = 0, error = 0; printf("How many sums would you like to calculate?\n"); scanf("%d",&ans); for (i = 0; i < ans; i++){ if (i%2 == 0) sum += 1/(double)(2*i + 1); else sum -= 1/(double)(2*i + 1); } printf("We calculated %lf\n",sum); printf("Our error is %lf\n", fabs(sum - PI_OVER_FOUR)); return 0; }
I think I've stolen your code well enough. This is what I get when I input 8. 0.754268 Our error is 0.0311302
Yes. Apparently, we have to sum a LOT of numbers to get close the error bound.
There's an identity we can use that makes it a lot easier to approximate \[π/4=4\arctan \frac{ 1 }{ 5 }−\arctan \frac{ 1 }{ 239 }\]
Hmmm. What identity is this?
The euler-machin one IIRC
That's pretty interesting. I have to go. Do you understand the ideas here?
Yep. Sorry for holding onto you for so damn long. I feel terrible. I'll get some buddies to medal you appropriately. thanks for stepping me through this!
It's not a problem. This was really fun. We should talk again. Good luck on any exams you may have.
PM me if you'd like. The feeling's mutual :)
Great, see ya!
Join our real-time social learning platform and learn together with your friends!