title: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
body: <p>although I know there's various questions looking for solutions to this error message, I've yet to find  an answer that helps me solve my code to get the comparison working, I have the code</p>
  
  <pre><code>def f(x,d,h,L):
      ans=0.
      if ((0.&lt;=x) &amp; (x&lt;d)):
          ans=h*(x/d)
      elif ((d&lt;=x) &amp; (x&lt;=L)):
          ans=((L-x)/(L-d))
      return ans
  
  x=np.linspace(0,10,1000)
  h=5*10**(-3)
  d=16*10**(-2)
  L=64.52*10**(-2)
  func=f(x,d,h,L)
  </code></pre>
  
  <p>But when I try running it I get an error pointing to the <code>if</code> line with the error code in the title, I've tried the proposed solutions given in similar questions such as using <code>np.logical_and</code> or <code>and</code> instead of <code>&amp;</code> but all three yield the same error, please help me out</p>