title: how to store my iterations into arrays in python?
body: <p>I've defined the following function which takes x and n as arguments, using Taylor series summation to approximate arctan. I also embedded a conditional statement inside so the function works for all x.
  import math</p>
  
  <pre><code>import math
  
  for x in range(1,10,1):
     def arctan(x, n):
         arctang=0
         inv_x=1/x
         for i in range(n):
          sign=(-1)**i
          arctang = arctang + ((inv_x**(2.0*i+1))/(2.0*i+1))*sign
  
         if x&gt;0:
          arc_tan=(math.pi/2)-arctang
  
         else:
             arc_tan=-(math.pi/2)-arctang
  
         return arc_tan
  
  
     print(arctan(x,100))
  </code></pre>
  
  <p>this code prints the iterations:</p>
  
  <p>0.7878981009052581</p>
  
  <p>1.1071487177940906</p>
  
  <p>1.2490457723982544</p>
  
  <p>1.3258176636680326</p>
  
  <p>1.3734007669450157</p>
  
  <p>1.4056476493802696</p>
  
  <p>1.4288992721907325</p>
  
  <p>1.446441332248135</p>
  
  <p>1.460139105621001</p>
  
  <p>however I want to be able to store the x values into an array, and these iterations into another so I can generate a graph out of the arrays, ie:
  something along the lines x=[1,2,3,4,5,6,7,8,9] y=[iterations as listed]</p>
  
  <p>How should I go about doing this? </p>
  
  <p>thanks!</p>