Check Machin-like formulas: Difference between revisions

Content added Content deleted
m (+gap)
Line 237: Line 237:
</lang>
</lang>


== {{heder|GAP}} ==
== {{header|GAP}} ==
The formula is entered as a list of pairs [k, x], where each pair means <math>k \mathrm{atan}(x)</math>, and all the terms in the list are summed. Like most other solutions, the program will only check that the tangent of the resulting sum is <math>1</math>. For instance, <code>Check([[5, 1/2], [5, 1/3]]);</code> returns also <code>true</code>, though the result is <math>\frac{5\pi}4</math>.
The formula is entered as a list of pairs [k, x], where each pair means <math>k \mathrm{atan}(x)</math>, and all the terms in the list are summed. Like most other solutions, the program will only check that the tangent of the resulting sum is <math>1</math>. For instance, <code>Check([[5, 1/2], [5, 1/3]]);</code> returns also <code>true</code>, though the result is <math>\frac{5\pi}4</math>.