For this assignment, you will need the arctangent1 function that you created for Arctangent Experiments.

In An Important Arctangent Identity, we saw that

How can we use this identity to write a better arctangent function?

Here's a mathematical way to think about it:


In general:


Translating the Math into Python

If we start with n = 1, we can loop through values of the xn's and the n's like this:

        x = x / (1 + squareroot(1 + x*x))
n *= 2

When the value of x gets reasonably small, you can apply arctangent1:

    return n * arctangent1(x)

Why do you think you are able to apply arctangent1 in your arctangent function?

1 2 3 4 5 6 7 8 9 10 11 12