title: How to find roots for a numpy array
body: <p>I am wondering how to find foots for an array. What I have now is:</p>
  
  <pre><code>import numpy as np
  from scipy.optimize import brentq as find_root
  
  t = np.linspace(0, 100)
  
  def f(x):
      return x ** 2 - t
  
  a = find_root(f, -400, 400)
  
  print(a)
  </code></pre>
  
  <p>It gives me a type array saying that:</p>
  
  <pre><code>TypeError: only size-1 arrays can be converted to Python scalars. 
  </code></pre>
  
  <p>I know the reason is that find_root can only take a scalar in its argument. What I want is to make “a” a bumpy array that finds root for the function given each possible value of t. Does that mean I need to write a loop for find_root? Or do I need to write a loop before I define the function? What’s the easiest way to do it?
  Thank you very much for helping. </p>