title: Evaluating integrals in Python 3.7; strange behaviour
body: <p>I written some code to approximate an integral: <img src="https://latex.codecogs.com/gif.latex?%5Cint_%7B1%7D%5E%7B2%7D(ln(x))%5Endx" title="\int_{1}^{2}(ln(x))^ndx" /> using Python 3.7, but some strange behaviour is happening which is giving me the wrong result. I derived the formula in the following way:</p>
  
  <p>Let <img src="https://latex.codecogs.com/gif.latex?I_%7Bn%7D=&space;%5Cint_%7B1%7D%5E%7B2%7D(ln(x))%5Endx" title="I_{n}= \int_{1}^{2}(ln(x))^ndx" /> then <img src="https://latex.codecogs.com/gif.latex?I_%7B0%7D=&space;%5Cint_%7B1%7D%5E%7B2%7D1dx&space;=&space;1" title="I_{0}= \int_{1}^{2}1dx = 1" /> and <img src="https://latex.codecogs.com/gif.latex?I_%7Bn%7D=&space;(2(ln(x)%5En))&space;-&space;nI_n_-_1" title="I_{n}= (2(ln(2)^n)) - nI_n_-_1" /> for n = 1,2,3...</p>
  
  <p>This implemented in my code:</p>
  
  <pre><code>import numpy as np
  
  I = 1
  for n in range(1,21):
      I = 2*(np.log(2))**n - n*I
  </code></pre>
  
  <p>This should result in I = 0.0000419426270488826, but my code is giving me 50.40429353428721. I've been trying to figure out what is happing using print statements:</p>
  
  <pre><code>print("Iteration: ",n)
  print("first half: ",2*(np.log(2))**n)
  print("second half: ", n*I)
  print("New I: ",I, "\n")
  </code></pre>
  
  <p>You can see that the second half of the equation turns negative in iteration 17, but I don't understand why, since both I and n should be positive. My guess is that this is where the problems start to occur. Does anyone know why the result is incorrect, and if my assumption is correct? I'm using Mac OS X el Capitan 10.11.6</p>