title: Modelling Population with Stochastic Model and a Random Variable
body: <p>So I have this stochastic model: N(t+1)=(1+r^3)N(t), where r is a random variable from a Normal Population with mean= -0.1 and standard deviation=0.2.</p>
  
  <p>I'm trying to make a histogram from 1000 samples of this random that will model my population, and I've tried a few things to no avail.</p>
  
  <p>So far I have:</p>
  
  <pre><code>import numpy as np 
  import numpy.random as npr 
  import matplotlib.pyplot as plt 
  npr.seed(101)
  
  N = np.zeros(11)
  N[0]=100
  tvec = np.arange(0, 10, 0.1)
  r = npr.normal(loc=2,scale=3, size=1000)
  
  for t in tvec[:10]:
      N[t+1]=(1+r**3)+N[t]
  
  plt.hist(N)
  </code></pre>
  
  <p>but that gives me an error. </p>
  
  <blockquote>
    <p>IndexError: only integers, slices (<code>:</code>), ellipsis (<code>...</code>),
    numpy.newaxis (<code>None</code>) and integer or boolean arrays are valid indices</p>
  </blockquote>
  
  <p>Which tells me that I'm not able to take the random numbers I'm sampling and use them in my equation.</p>
  
  <p>So, I'm wondering if there's a different way I could be going about this?</p>
  
  <p>Thanks in advance!</p>