using a while loop to calculate arctan taylor series in python

need to estimate arctan and subtract the current value from the last value. I'm very new to python and I have only this so far:

again==1
while again==1:
    x = float(input('enter tangent'))
    tolerance=input('enter reasonable tolerance')
    import math
    n=0
    while estimate-estimate>=tolerance:
        estimate=(-1**n)(x**(n+1))/(2n+1)
        n=n+1
        print(estimate)

    print(math.atan(x))
    difference=estimate-(math.atan(x))
    print(difference)
    again = int(input("do you want to run program again? yes = 1, no =0"))

How do I go about finding the difference between the current arctan value and the last value and how do I output the number of terms used?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation