title: Runtime Warning Using power with Numpy
body: <p>I'm using power function from numpy and i'm obtaining a warning message. This is the code:</p>
  
  <pre><code>import numpy as np
  
  
  def f(x, n):
      factor = n / (1. + n)
      exponent = 1. + (1. / n)
      f1_x = factor * np.power(0.5, exponent) - np.power(0.5 - x, exponent)
      f2_x = factor * np.power(0.5, exponent) - np.power(x - 0.5, exponent)
      return np.where((0 &lt;= x) &amp; (x &lt;= 0.5), f1_x, f2_x)
  
  fv = np.vectorize(f, otypes='f')
  x = np.linspace(0., 1., 20)
  print(fv(x, 0.23))
  </code></pre>
  
  <p>And this is the warning message:</p>
  
  <blockquote>
    <p>E:\ProgramasPython3\LibroCientifico\partesvectorizada.py:8:
    RuntimeWarning: invalid value encountered in power   f2_x = factor *
    np.power(0.5, exponent) - np.power(x - 0.5, exponent)
    E:\ProgramasPython3\LibroCientifico\partesvectorizada.py:7:
    RuntimeWarning: invalid value encountered in power   f1_x = factor *
    np.power(0.5, exponent) - np.power(0.5 - x, exponent) [-0.0199636 
    -0.00895462 -0.0023446   0.00136486  0.003271    0.00414007
      0.00447386  0.00457215  0.00459036  0.00459162  0.00459162  0.00459036
      0.00457215  0.00447386  0.00414007  0.003271    0.00136486 -0.0023446  -0.00895462 -0.0199636 ]</p>
  </blockquote>
  
  <p>I don't know what is the invalid value. And I don't know how to specify that with where numpy function f2_x is only valid for values between >0.5 and &lt;= 1.0.
  Thanks</p>