2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/normal-distribution-z/generate_numbers.py
2016-08-02 16:09:14 +02:00

17 lines
474 B
Python
Executable file

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