Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 16, 2022 18:03
Show Gist options
  • Select an option

  • Save galenseilis/4e73306fe17075eabf05c6b7dc4ff06f to your computer and use it in GitHub Desktop.

Select an option

Save galenseilis/4e73306fe17075eabf05c6b7dc4ff06f to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
z1 = np.random.chisquare(10, 10**4)
z2 = np.random.chisquare(10, 10**4)
c = 10
y = (z1 + c) / (z1 - z2)
sort_y = np.sort(y)
density = stats.gaussian_kde(sort_y)
plt.hist(y, bins=100)
plt.yscale('log')
plt.plot(sort_y, density(sort_y))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment