title: Calculating rate of decay of a material in python
body: <p>I have to calculate rate at which a material is decaying. I have set of 5 measurements of the material over a period of 5 years. Below is my approach:-</p>
  
  <p>I have added initial as well as the testing uncertainties as noise using monte carlo method.</p>
  
  <p>Initially I have assumed the rate to be linear, using np.linalg.lstsq I have calculated the rates, essentially slope of the line.</p>
  
  <p>Now I want to calculate the rate assuming rate is accelerating curve, decay is more when material loss is more.</p>
  
  <p>This is something like:-</p>
  
  <pre><code>np.random.seed(0)
  
  x_data = np.linspace(0, 5, num=50).reshape(-1,1)
  
  # function something in the form of y = variable^x, taking variable value as 
  #1.1 below
  var = 1.1
  y_data = np.power(var, x_data)
  
  plt.figure(figsize=(6, 4))
  plt.scatter(x_data, y_data)
  plt.show()
  </code></pre>
  
  <p>I looked at np.polyfit  &amp; curve_fit options, still trying to figure out to calculate the rate.</p>