Skip to content

Instantly share code, notes, and snippets.

@rahulbhadani
Created May 25, 2022 14:52
Show Gist options
  • Save rahulbhadani/3f62b0ae49cc55cbb31c5f0160b1a6a6 to your computer and use it in GitHub Desktop.
Save rahulbhadani/3f62b0ae49cc55cbb31c5f0160b1a6a6 to your computer and use it in GitHub Desktop.
Y = X^3 where X~U[0, 2]
import numpy as np
import matplotlib.pyplot as plt
import seaborn as s
import matplotlib as mpl
import pyplot_themes as themes
themes.theme_solarized(scheme="dark", grid=False, ticks=False,)
mpl.rcParams['font.family'] = 'Serif'
from scipy.stats import rv_continuous
class YCube(rv_continuous):
"YCube Power distribution"
def _pdf(self, x):
y = 0
if (x < (self.a)):
y = 0
elif (x > (self.b)):
y = 0
else:
y= (1.0/6.0)*(x**(-2.0/3.0))
return y
P = YCube(name='pareto', a= 0, b =8)
B = P.rvs(size = 10000)
s.distplot(B)
plt.xlabel('$y$', color = '#DAD6D6')
plt.ylabel('f(y)', color = '#DAD6D6')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment