I am trying to calculate the exact median of a simple standard normal PDF in Python 36. The code looks like this:
from scipy.stats import norm
from pynverse import inversefunc
mean = 'some_number'
standard_deviation = 1
inverse_normal_pdf = inversefunc(lambda x: norm.pdf(x, mean, standard_deviation))
median = inverse_normal_pdf(norm.pdf(float('-inf'), mean, standard_deviation)+.5)
I use the pynverse library to get the inverse of the normal PDF and use the solver for upper limit of integration from here to arrive to the solution for the median. But this method works for only means in the range [-8.6:11.2], and any other mean outside this range gives me exactly the number 2.6180339603380443 for some reason. I can't figure out what's happening here? What is this number?