generate_numbers.py 474 B

123456789101112131415161718
  1. #!/usr/bin/env python
  2. """
  3. Generate the LaTeX code for a table of the PPF of a normal distribution.
  4. PPF stands for Percent point function (inverse of cdf - percentiles).
  5. """
  6. from scipy.stats import norm
  7. from numpy import arange
  8. for x in arange(0.0, 1.0, 0.1):
  9. line = "\\textbf{%0.1f} & " % x
  10. values = [norm.ppf(x + dx) for dx in arange(0.00, 0.09 + 0.01, 0.01)]
  11. values = ["%0.4f" % el for el in values]
  12. line += " & ".join(values)
  13. print(line + "\\\\")