title: keep getting "only length-1 arrays can be converted to Python scalars"
body: <p>I kept getting the error <code>only length-1 arrays can be converted to Python scalars</code>. Most people suggest sometimes numpy is not compatible with other existing math functions. but I changed every math function to np functions. </p>
  
  <p>The error states:</p>
  
  <pre><code>Traceback (most recent call last):   File "/Users/jimmy/Documents/2.py", line 20, in &lt;module&gt;
      eu = mc_simulation(89,102,0.5,0.03,0.3,1000)   File "/Users/jimmy/Documents/2.py", line 12, in mc_simulation
      ST = s0 * exp((r - 0.5 * sigma ** 2) * T + sigma * a * z) TypeError: only length-1 arrays can be converted to Python scalars
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>from numpy import *
  import numpy as np
  from math import exp
  
  def mc_simulation(s0, K, T, r, sigma, no_t):
  
      random.seed(1000)
      z = random.standard_normal(no_t)
  
      ST = s0 * exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * z)
  
      payoff = maximum(ST - K, 0)
  
      eu_call = exp(-r * T) * sum(payoff) / no_t
  
      return eu_call
  
  
  eu = mc_simulation(89,102,0.5,0.03,0.3,1000)
  </code></pre>