title: Invert a function in python without solving for it
body: <p>I have a function that calculates the cumulative distributive function(cdf) of a skewed gaussian as follows.</p>
  
  <pre><code>from scipy import specials
  
  def cdf(x,location,scale,a):
      temp = (x-location)/abs(scale)
      return 0.5*(1+special.erf(temp/np.sqrt(2))) - 2.0*special.owens_t(temp,a)
  </code></pre>
  
  <p>How do I find the value of <code>x</code>(accurately) that gives a cdf of 99.9987. My current method incorporates using <code>linspace</code> between two limits, calculating the cdf for the linspace array and finding the value that is closest to 99.9987. However, this method is not very robust and breaks easily due to cdf not being a linear function.</p>