42 lines
2.7 KiB
Plaintext
42 lines
2.7 KiB
Plaintext
[[wp:Machin-like_formula|Machin-like formulas]] are useful for efficiently computing numerical approximations for <big><big><math>\pi</math></big></big>
|
|
|
|
|
|
;Task:
|
|
Verify the following Machin-like formulas are correct by calculating the value of '''tan''' (''right hand side)'' for each equation using exact arithmetic and showing they equal '''1''':
|
|
|
|
: <math>{\pi\over4} = \arctan{1\over2} + \arctan{1\over3}</math>
|
|
: <math>{\pi\over4} = 2 \arctan{1\over3} + \arctan{1\over7}</math>
|
|
: <math>{\pi\over4} = 4 \arctan{1\over5} - \arctan{1\over239}</math>
|
|
: <math>{\pi\over4} = 5 \arctan{1\over7} + 2 \arctan{3\over79}</math>
|
|
: <math>{\pi\over4} = 5 \arctan{29\over278} + 7 \arctan{3\over79}</math>
|
|
: <math>{\pi\over4} = \arctan{1\over2} + \arctan{1\over5} + \arctan{1\over8}</math>
|
|
: <math>{\pi\over4} = 4 \arctan{1\over5} - \arctan{1\over70} + \arctan{1\over99}</math>
|
|
: <math>{\pi\over4} = 5 \arctan{1\over7} + 4 \arctan{1\over53} + 2 \arctan{1\over4443}</math>
|
|
: <math>{\pi\over4} = 6 \arctan{1\over8} + 2 \arctan{1\over57} + \arctan{1\over239}</math>
|
|
: <math>{\pi\over4} = 8 \arctan{1\over10} - \arctan{1\over239} - 4 \arctan{1\over515}</math>
|
|
: <math>{\pi\over4} = 12 \arctan{1\over18} + 8 \arctan{1\over57} - 5 \arctan{1\over239}</math>
|
|
: <math>{\pi\over4} = 16 \arctan{1\over21} + 3 \arctan{1\over239} + 4 \arctan{3\over1042}</math>
|
|
: <math>{\pi\over4} = 22 \arctan{1\over28} + 2 \arctan{1\over443} - 5 \arctan{1\over1393} - 10 \arctan{1\over11018}</math>
|
|
: <math>{\pi\over4} = 22 \arctan{1\over38} + 17 \arctan{7\over601} + 10 \arctan{7\over8149}</math>
|
|
: <math>{\pi\over4} = 44 \arctan{1\over57} + 7 \arctan{1\over239} - 12 \arctan{1\over682} + 24 \arctan{1\over12943}</math>
|
|
: <math>{\pi\over4} = 88 \arctan{1\over172} + 51 \arctan{1\over239} + 32 \arctan{1\over682} + 44 \arctan{1\over5357} + 68 \arctan{1\over12943}</math>
|
|
|
|
and confirm that the following formula is ''incorrect'' by showing '''tan''' (''right hand side)'' is ''not'' '''1''':
|
|
|
|
: <math>{\pi\over4} = 88 \arctan{1\over172} + 51 \arctan{1\over239} + 32 \arctan{1\over682} + 44 \arctan{1\over5357} + 68 \arctan{1\over12944}</math>
|
|
|
|
These identities are useful in calculating the values:
|
|
: <math>\tan(a + b) = {\tan(a) + \tan(b) \over 1 - \tan(a) \tan(b)}</math>
|
|
|
|
: <math>\tan\left(\arctan{a \over b}\right) = {a \over b}</math>
|
|
|
|
: <math>\tan(-a) = -\tan(a)</math>
|
|
|
|
<br>
|
|
You can store the equations in any convenient data structure, but for extra credit parse them from human-readable [[Check_Machin-like_formulas/text_equations|text input]].
|
|
|
|
Note: to formally prove the formula correct, it would have to be shown that ''<math>{-3 \pi \over 4}</math> < right hand side < <math>{5 \pi \over 4}</math>'' due to ''<math>\tan()</math>'' periodicity.
|
|
|
|
<br><br>
|
|
|