In [2]:
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as spst
import sympy
%matplotlib inline
In [3]:
sympy.init_printing()
x=sympy.Symbol(“x”)
lmbda=sympy.symbols(“lambda”,positive=True)
x,lmbda
Out[3]:
$\displaystyle \left( x, \ \lambda\right)$
$f(x)=\lambda exp(-\lambda x), x>0$
In [4]:
#derive the cdf
pdf=lmbda*sympy.exp(-lmbda*x)
cdf=sympy.integrate(pdf,(x,0,x))
In [10]:
#compute the inverse cdf
u=sympy.Symbol(“u”)
#[0]:get the result from the list
inv_cdf=sympy.solve(cdf-u,x)[0]
In [13]:
sampling=sympy.lambdify((lmbda,u),inv_cdf,”numpy”)
In [14]:
samples=sampling(2,np.random.rand(1000))
Out[14]:
array([3.24152438e-01, 3.18944309e-01, 1.49667023e-02, 8.50551921e-01,
1.21696312e-01, 7.35181418e-02, 4.01189788e-01, 2.76995527e-01,
3.87660041e-01, 1.46613300e-01, 3.95264334e-01, 1.47406621e-01,
1.47070388e+00, 1.93960285e-01, 1.83045011e+00, 3.61343882e-02,
2.14226127e-01, 1.43266639e-01, 2.19902063e-01, 5.02273077e-01,
5.08884524e-01, 1.66130984e-01, 1.12437255e+00, 8.23166176e-01,
1.74281882e-01, 2.92291622e-01, 3.34794193e-01, 5.17272703e-01,
1.65344764e+00, 3.63016071e-03, 1.06734910e+00, 4.43992714e-01,
2.05757331e-01, 5.75686291e-02, 3.88246276e-02, 1.16257626e-01,
1.85695576e-01, 1.82557676e-01, 2.08716878e+00, 7.09301772e-02,
9.84297279e-02, 7.70014088e-02, 8.93481836e-01, 3.54695225e-01,
1.13227056e+00, 3.88229444e-01, 2.58475138e-01, 1.10283608e-01,
1.24784474e-01, 2.50595153e-01, 5.82396330e-01, 3.08543784e-01,
6.54793736e-01, 1.04211627e-02, 2.48390431e-01, 1.26553620e+00,
3.43520579e-03, 6.19980014e-01, 1.88826713e-01, 3.42031994e-01,
3.03171447e-01, 9.06248142e-01, 6.28605505e-02, 2.63764155e-02,
2.40764761e-01, 2.97740388e-01, 1.32461192e-01, 1.07656818e+00,
1.17424446e+00, 2.53822470e-01, 4.18791714e-03, 9.15024658e-01,
2.44364955e-01, 1.54857378e-01, 6.95240958e-01, 3.44652898e-01,
2.23173151e-01, 7.15498891e-01, 1.21156101e+00, 6.79952965e-02,
6.46016343e-01, 2.40490207e-01, 1.23563697e+00, 1.93545131e-01,
4.14314548e-02, 1.14603899e-01, 3.43272626e-01, 1.25026713e-01,
6.18491979e-01, 3.24974815e-01, 1.49693150e-01, 4.25859248e-01,
2.02849072e-02, 7.11860607e-01, 6.23640658e-02, 2.76996644e-01,
5.72290650e-01, 4.30718162e-01, 1.27579447e+00, 4.22297640e-01,
1.30690564e-01, 8.83070998e-01, 4.18194644e-01, 1.75239672e-01,
5.91024218e-01, 5.34302328e-01, 1.11001543e-02, 1.41417229e+00,
1.95963921e-01, 2.27028424e+00, 4.72453089e-01, 1.18138725e-01,
9.51284372e-01, 1.26588533e-01, 1.25030135e-02, 4.63434219e-01,
1.17773472e-01, 4.17568639e-02, 6.54267099e-01, 1.54557078e+00,
1.56952097e-02, 4.89034341e-01, 1.78789221e-01, 2.39043371e-01,
2.57386411e-02, 2.42623521e-01, 1.35552679e-01, 9.30533169e-01,
2.39062591e-01, 1.92882238e-01, 5.12228811e-01, 3.71664969e-01,
7.70858586e-02, 1.56050240e-01, 1.18237717e-01, 8.16085340e-01,
2.15803705e-02, 1.79408783e+00, 2.43037746e-01, 2.82371749e-01,
1.52020710e-01, 3.73101716e-02, 3.90775551e-01, 6.71482061e-02,
1.11653441e+00, 5.07553734e-01, 1.10008383e-01, 3.69384836e-01,
3.13468261e-01, 3.61043044e-01, 2.68736105e-01, 4.27561125e-01,
1.21878555e-01, 1.83429124e-01, 4.57105734e-01, 5.91457816e-02,
5.58579374e-01, 3.04528039e-03, 3.16742932e-01, 8.52494782e-02,
9.96609606e-01, 1.54425718e-01, 1.59634278e-01, 1.66612829e-01,
1.42092980e-01, 2.29602316e-01, 6.86916132e-01, 7.95201463e-02,
9.87102611e-01, 6.22554211e-01, 6.16606544e-01, 3.79950382e-01,
1.21046649e-01, 5.19109015e-01, 3.85108682e-01, 3.13672740e-01,
5.30435544e-01, 1.76068347e+00, 2.91453311e-01, 3.23928216e-01,
9.33858928e-01, 1.07778300e+00, 8.08970504e-01, 1.15340606e-01,
2.82654511e-01, 2.62345933e-01, 1.12921935e+00, 2.05392218e-01,
2.03179672e+00, 5.63089766e-01, 5.91479663e-01, 6.09936500e-01,
1.16008323e+00, 7.99135635e-01, 4.91419984e-02, 2.18498772e+00,
5.19802892e-01, 4.52008047e-01, 2.32396696e-01, 1.04878109e+00,
2.62653465e-02, 7.87580110e-01, 2.87786822e-01, 1.58776519e-01,
1.24962704e-02, 1.42476611e+00, 1.27878007e+00, 4.24909937e-01,
2.51564828e-01, 1.60523619e-01, 6.63424566e-01, 2.28001183e-01,
4.29341253e-01, 4.62097973e-01, 1.18600644e-01, 6.36029786e-01,
6.72944542e-01, 1.24476897e+00, 1.48176325e+00, 3.63148364e-01,
1.91777800e-01, 1.29001765e-01, 6.94776835e-01, 8.08055255e-01,
1.16745002e-02, 1.43171883e-02, 1.00326051e-01, 5.97973982e-01,
2.18352293e-01, 5.41472417e-02, 3.34337113e-02, 2.80141532e-01,
6.09815416e-01, 3.99288235e-01, 3.99694795e-01, 2.52267914e-01,
1.50539840e+00, 6.43085632e-01, 1.02122554e+00, 5.46752392e-01,
8.02825416e-02, 5.82748299e-02, 7.03573758e-01, 6.07826260e-01,
3.46943737e-01, 5.45576976e-01, 2.56470577e-01, 5.85095266e-01,
2.10247465e-01, 2.37528643e-01, 5.15063503e-01, 3.02579144e-02,
2.44709604e-01, 5.02718085e-02, 7.79535061e-01, 1.78414952e+00,
2.38379933e-01, 7.70772805e-01, 9.00575247e-01, 5.54584707e-01,
2.69700864e-01, 6.45329268e-01, 7.35582294e-01, 6.73347757e-01,
2.91245762e-01, 4.50557819e-01, 1.23162419e-01, 6.18686184e-03,
1.52797129e-01, 9.27394862e-02, 1.08931621e+00, 1.04268659e+00,
5.60306696e-01, 2.43126233e-01, 9.41029640e-02, 5.89945994e-01,
6.25509693e-01, 5.01025928e-01, 5.67738649e-01, 1.65580979e+00,
6.70096518e-02, 7.89475131e-02, 5.38075748e-01, 1.04999839e-01,
1.14765431e+00, 6.05765392e-01, 1.48846018e-01, 6.78579439e-01,
6.13331109e-01, 1.04769687e+00, 6.51399083e-01, 1.40073264e-02,
1.34121683e+00, 1.89321716e-01, 4.86686820e-01, 2.64403593e-01,
2.70116300e-01, 1.75793537e-02, 2.85479388e-01, 3.31520987e-01,
2.91865778e-01, 1.15600107e+00, 5.40003559e-01, 2.40563568e-01,
4.74429857e-01, 2.52102764e-01, 1.02555400e-01, 1.19236206e-01,
5.25225904e-01, 1.67753215e+00, 1.81021141e-01, 5.97671973e-01,
6.26471218e-02, 6.73268895e-01, 1.56771271e-01, 2.67222347e-01,
1.09738437e+00, 4.10274585e-01, 5.98302748e-01, 2.27015664e-01,
8.20863783e-01, 9.37842704e-01, 2.76698000e-03, 2.25290917e-01,
1.89549707e-01, 1.93242532e-01, 1.26810630e-01, 4.44380470e-01,
9.70973705e-02, 1.37120821e+00, 6.16969728e-01, 1.13004185e-01,
3.53493557e-01, 7.07322106e-02, 8.86226070e-01, 9.84595025e-02,
3.16722595e-01, 2.05839014e+00, 1.42985833e-02, 4.10530474e-01,
9.54849502e-02, 7.29392931e-03, 1.55623005e+00, 4.98117475e-01,
1.38395809e-01, 3.22073613e-01, 3.94775729e-01, 6.43671527e-01,
4.65859850e-01, 3.94562077e-01, 2.43275733e-01, 2.08865267e-01,
6.08341005e-01, 1.31280574e+00, 7.28752635e-02, 1.42474678e+00,
2.57795424e-01, 2.48901454e-02, 1.07667747e-01, 1.30768369e+00,
3.90459921e-01, 1.00812820e+00, 2.78965317e-02, 3.50893396e-02,
1.29965732e-01, 8.99800713e-02, 1.90871628e-01, 2.77832006e-01,
1.73882294e-01, 2.02011256e+00, 1.13787836e-01, 1.26134879e-01,
8.31628341e-02, 1.39790415e+00, 2.90802933e-01, 1.64608304e-01,
1.23465375e+00, 2.24131608e-01, 1.26887450e+00, 2.63290495e+00,
2.20437790e-01, 7.49396219e-02, 2.34217676e-01, 1.41598371e-01,
3.32757970e-01, 3.59438400e-01, 6.98523053e-02, 3.19877320e-01,
2.19238668e-02, 1.57924881e+00, 5.29844208e-01, 3.03372053e-02,
9.17175909e-03, 9.67085239e-01, 5.36888011e-01, 1.80869652e-01,
2.12234458e-01, 4.76756515e-02, 4.67428046e-01, 1.17492311e+00,
1.01218509e+00, 5.81743122e-01, 8.01518865e-01, 3.31488406e-01,
3.35254118e-02, 1.04123345e-02, 2.31029609e-01, 9.62857219e-01,
1.07527482e-01, 4.04108308e-01, 3.35813225e-01, 1.02238276e+00,
1.30467490e+00, 5.72549233e-03, 1.06836397e+00, 5.65729074e-01,
3.89587861e-02, 3.61493834e-01, 8.26490336e-01, 7.14328430e-01,
1.17292287e+00, 1.79883090e+00, 1.49993808e-01, 9.81604653e-02,
8.80187779e-01, 3.34838361e-01, 3.86063909e-01, 9.34978778e-01,
3.07115303e-01, 1.31279739e+00, 1.81922746e+00, 2.54842117e-01,
2.31921196e-02, 9.17899155e-01, 1.87826653e-01, 6.17328259e-01,
7.02977073e-01, 6.28352959e-01, 1.19673182e+00, 1.47202998e-01,
9.32790342e-01, 6.99188839e-03, 4.64093314e-01, 1.24796548e-01,
3.47221587e-01, 2.38256351e-02, 3.38027993e-01, 1.32353600e+00,
2.80515265e-01, 3.19318952e-01, 5.18794220e-01, 4.81530480e-02,
4.32327873e-01, 3.44114004e-01, 5.88909986e-01, 4.03460856e-01,
8.34816617e-01, 1.64999377e-01, 4.53788696e-02, 1.00705153e+00,
8.47083071e-01, 3.88495883e-01, 4.53872761e-01, 2.91469766e-01,
6.19884617e-01, 3.13580901e-01, 2.07320526e-01, 2.63770060e-01,
1.66480709e+00, 3.95513253e-01, 3.98862788e-01, 2.91343890e-01,
5.09958570e-02, 1.82973574e-01, 9.39836346e-01, 9.82135209e-01,
1.05049430e-01, 2.89509993e-01, 1.16213981e-01, 4.62930790e-01,
1.54318598e+00, 5.31157037e-01, 3.32930337e-01, 3.55574684e-02,
8.55593102e-03, 1.52315862e+00, 8.12343395e-02, 8.50362555e-01,
1.02131410e+00, 8.39267640e-01, 7.84825204e-01, 8.31473050e-02,
2.79488900e-01, 2.03549000e-01, 2.45092531e-01, 4.30157873e-01,
4.31087020e-01, 1.05987910e+00, 2.83545526e+00, 1.22836137e+00,
5.61863642e-01, 9.16985511e-01, 1.13241720e+00, 8.59165524e-01,
1.35780650e+00, 4.30614228e-01, 3.50943269e-01, 1.53205222e+00,
3.79708107e-01, 2.32606409e-01, 3.11825483e-02, 4.73556840e-02,
7.23781307e-01, 1.77785513e-02, 2.68352760e-01, 5.03518696e-01,
1.31601549e+00, 1.41548439e-01, 2.51952464e-01, 6.69061227e-01,
5.95786387e-02, 3.59738876e-01, 3.71579250e-02, 5.31883121e-01,
7.03024775e-03, 1.27602440e-01, 4.57647871e-01, 4.77798753e-01,
4.22547621e-01, 1.63995621e+00, 4.10751203e-01, 3.99804518e-02,
7.11278023e-01, 1.24608234e-01, 8.33770090e-02, 9.53521340e-01,
8.05276886e-02, 4.89912657e-01, 5.18449791e-01, 2.51881845e-02,
2.34521975e-01, 3.94112728e-01, 3.73904487e-01, 9.86724595e-02,
3.12517899e-01, 2.61090485e-01, 5.69604867e-02, 5.64406871e-02,
2.08559086e-01, 2.04769151e-01, 5.85050443e-01, 1.41425295e+00,
3.32945902e-03, 1.26091318e-01, 3.10387333e-01, 1.89631119e+00,
5.17101229e-03, 4.66075014e-01, 5.13964147e-01, 1.05131749e+00,
3.30871206e+00, 6.66386364e-01, 4.39459842e-01, 5.29046607e-03,
4.45261959e-01, 6.51889074e-02, 3.70375987e-01, 6.15905781e-01,
1.88188217e+00, 1.65277369e+00, 1.91767929e-01, 9.20679761e-01,
1.59157649e-01, 6.76046654e-01, 6.04626352e-01, 3.27190491e-01,
3.78303254e-01, 1.69752294e-01, 5.31902754e-01, 1.21862389e-01,
6.47626821e-03, 2.36988187e-01, 9.74137707e-01, 6.86628445e-02,
2.15539362e-01, 8.46489008e-01, 8.89006116e-01, 8.02209964e-02,
8.10468418e-02, 7.88032662e-01, 3.19270604e-02, 8.98705296e-01,
3.65108702e-01, 1.60975717e+00, 1.23548800e-01, 6.69213460e-01,
1.97547442e-01, 4.51355481e-01, 4.39973571e-01, 3.88901969e-01,
1.22166060e-01, 9.69985621e-02, 1.58874558e+00, 4.14340693e-01,
1.14028382e+00, 2.81355611e-01, 8.62665364e-01, 2.57477757e-01,
5.60171817e-02, 2.57687154e-01, 3.74365142e-01, 2.07467762e-01,
5.61005915e-03, 3.95235687e-01, 1.63166311e+00, 3.09566802e-01,
4.20487232e-01, 7.79189696e-02, 6.29633002e-02, 1.36766764e-01,
2.42575409e-01, 6.60845474e-01, 7.11801466e-01, 1.47687710e+00,
4.07491044e-01, 1.96008648e-01, 2.81375003e-02, 1.36367742e+00,
5.68504367e-01, 2.45008409e-02, 2.02316519e-01, 3.65782233e-01,
1.37018656e+00, 1.62455295e-01, 9.51128714e-01, 1.28763268e+00,
2.93683001e-01, 9.98702402e-01, 1.22047793e-02, 4.92308763e-01,
1.17462556e-01, 8.06240221e-01, 6.55226313e-01, 1.17967828e-01,
3.08070536e-01, 2.06088479e-01, 8.74196550e-02, 9.92108002e-01,
7.29491043e-03, 3.22595954e-01, 3.91439205e-01, 8.38477774e-01,
3.89833826e-01, 9.93449671e-01, 2.52753512e-01, 2.59722814e-01,
1.49746004e-01, 8.47114471e-01, 1.49752466e-01, 5.94338505e-01,
7.88222739e-01, 1.14324551e-01, 1.03055084e-01, 1.44137458e+00,
7.48751854e-01, 4.42161294e-01, 1.31218514e-01, 2.39701702e-01,
3.67177943e-01, 3.36849303e-01, 1.05378450e+00, 2.64489086e-01,
3.43517315e-01, 1.45391750e+00, 2.16874996e+00, 1.07206459e-01,
3.51508794e-01, 1.09452310e-01, 7.64784448e-01, 1.22621544e-01,
2.19688639e-01, 4.50889246e-01, 8.92064407e-02, 8.21005088e-01,
8.97550595e-01, 1.71794012e-02, 2.65892698e+00, 4.12742493e-02,
1.63529373e-01, 1.48381447e-01, 3.69289190e-01, 3.90547420e-01,
1.58371419e-01, 2.84906092e-01, 1.24390458e+00, 6.22503286e-01,
3.84384905e-02, 8.18098119e-03, 1.63203203e+00, 1.26489999e+00,
1.35978680e-01, 1.89970640e-01, 3.23214700e-01, 6.17780465e-02,
1.66976982e-01, 2.44519337e-01, 1.33717474e-01, 1.25005097e+00,
4.46035720e-01, 4.89289105e-02, 2.30587081e-01, 4.08193508e-01,
2.21064605e-02, 1.55068805e-03, 1.17623235e+00, 4.92370008e-01,
5.95779779e-01, 1.35174355e+00, 8.79531457e-01, 1.35455515e-01,
7.48820904e-02, 2.04422304e-01, 9.85242813e-02, 6.42224571e-01,
1.22102823e+00, 3.54052028e-01, 5.00187390e-01, 1.50104881e+00,
2.07774570e-01, 5.31141221e-01, 2.00735462e-01, 3.35135674e-01,
2.19136373e+00, 1.80406304e-01, 6.65535875e-02, 7.78778788e-01,
1.65179980e-01, 3.48226958e-01, 2.42570742e-01, 1.57996603e-01,
3.19378645e-01, 2.98572393e-01, 1.30316729e+00, 1.18162276e-01,
3.94089700e-01, 8.56835533e-01, 2.47991832e-01, 6.42409629e-01,
2.16571583e-01, 4.31730088e-01, 2.59036029e-01, 4.19674082e-01,
6.62553791e-02, 1.42479001e-02, 1.20861267e-01, 5.12255167e-01,
3.35691716e-02, 1.23438603e+00, 2.41530207e+00, 2.36643697e-01,
2.85256734e-01, 2.89003619e-01, 1.33534500e-01, 3.02509465e-01,
1.18686531e-01, 3.01396406e+00, 2.07717070e-02, 9.04505436e-01,
1.17835761e-01, 1.01064646e-02, 6.12218761e-01, 5.62810591e-01,
8.52064635e-03, 5.21891011e-01, 3.01061356e-01, 2.11793534e-01,
7.95519516e-01, 1.72544540e-01, 6.80804815e-01, 6.14661326e-02,
3.74004770e-01, 2.20817842e-01, 9.18661686e-01, 3.76989814e-01,
1.07852234e+00, 2.20359396e-01, 2.05304951e-02, 3.01912304e-01,
1.67067593e-01, 1.13464560e+00, 1.38649506e+00, 8.96733493e-01,
8.37905666e-03, 2.44584441e-01, 1.51433193e-01, 4.43512901e-01,
1.45882875e+00, 1.18886494e-01, 2.57283659e-01, 1.96910493e-01,
1.56053584e-01, 7.41488061e-01, 5.61190535e-01, 9.57761767e-01,
5.26703633e-01, 1.52143902e-01, 1.05144075e-01, 6.91600337e-02,
3.58263615e-02, 1.81412319e+00, 1.29845071e-01, 8.99857342e-01,
1.03247407e+00, 1.36460713e-02, 8.47087287e-02, 3.55770643e-01,
3.33786443e-01, 1.01919755e-01, 1.67383307e-01, 2.56887983e-01,
1.50976843e+00, 1.50386350e+00, 3.57818218e-01, 7.39445654e-01,
1.00497041e-01, 2.68284563e-01, 3.70513179e-01, 1.15489689e+00,
4.93785695e-01, 1.25202813e+00, 3.25695352e-01, 1.75600957e-01,
1.85700171e-03, 9.84829279e-02, 4.07576363e-02, 6.07833180e-01,
1.26008521e+00, 6.48252977e-02, 8.88040906e-03, 1.03174064e-01,
2.41904773e-01, 2.48485094e-01, 1.13470230e+00, 8.27018457e-01,
4.45107140e-01, 2.10497876e-01, 7.99447347e-01, 2.32621417e-01,
2.00621320e-02, 5.60865616e-01, 5.83657866e-01, 5.36408028e-02,
5.87127628e-01, 5.35346416e-01, 1.29234087e+00, 2.71228396e+00,
2.76037104e-01, 1.47496730e+00, 5.34583714e-02, 1.89093419e-01,
3.35192904e-01, 2.23173932e+00, 8.04318500e-02, 2.65977470e-01,
2.31651548e-01, 5.86584729e-01, 3.01462091e-02, 2.84513375e-02,
5.08241074e-01, 1.56151178e+00, 2.27851708e-02, 9.61529648e-01,
8.27575803e-01, 2.39238645e-01, 1.59385220e-02, 1.58699028e+00,
2.01884418e-01, 1.00172498e+00, 4.05692699e-01, 2.27450133e-02,
2.16657612e-01, 5.73957044e-01, 6.19739764e-01, 3.67340925e-01,
3.36732912e-02, 4.92541711e-01, 1.42252571e-01, 6.21105753e-01,
5.85998101e-01, 2.35550083e-01, 9.29876722e-02, 8.90256725e-01,
7.54015646e-01, 3.44715384e-01, 2.57201204e-02, 8.26912942e-01,
4.25189484e-01, 3.71809442e-02, 1.05985079e+00, 6.91528834e-02,
8.63731631e-01, 1.66457593e-01, 2.75853554e-01, 4.22907371e-01,
1.41501236e-01, 8.58713105e-01, 2.74603721e-01, 1.58155923e+00,
6.42764594e-02, 1.07832969e-01, 2.31144834e-01, 5.26448825e-01,
2.09204318e+00, 2.17599812e-03, 6.91717417e-01, 1.18352654e-01,
1.06894524e+00, 5.97616896e-01, 2.36636579e-01, 8.55920662e-01,
1.31232240e+00, 1.00590027e+00, 4.62166740e-01, 3.35294291e-01,
6.12709874e-01, 2.39832787e-02, 9.23143170e-02, 1.28009189e+00,
4.89311814e-01, 1.10743891e+00, 2.32489074e-01, 4.13340809e-01,
6.45884368e-01, 3.19754674e-01, 6.36197460e-03, 8.44524245e-01,
8.95624528e-02, 9.64880285e-03, 1.95123570e-01, 1.46312719e-01,
4.89570216e-01, 1.48384141e+00, 2.43594326e-01, 1.05017228e-01,
2.34882554e-01, 2.73950458e-01, 6.54770022e-02, 2.17593268e-02,
6.25065201e-01, 9.45332300e-01, 1.96917416e+00, 8.78435626e-01,
2.54016371e-01, 9.07173723e-02, 2.03640896e+00, 2.93657774e-02,
3.68670135e-04, 9.35443166e-01, 3.02661777e-01, 3.49194806e-01,
1.32754879e-01, 4.24553150e-01, 5.72693772e-02, 1.27154536e+00,
5.54608955e-01, 1.91903023e-01, 4.76808462e-01, 3.41337728e-01,
5.27663115e-01, 1.15882747e+00, 3.34577891e-01, 1.26526816e-01,
2.47090562e-01, 8.10126180e-01, 1.39315704e+00, 9.28635082e-01,
8.54405125e-03, 1.75153995e-01, 4.32021728e-02, 1.81182952e-01,
4.09564056e-01, 1.08311014e+00, 3.78473964e-01, 4.31312194e-01,
8.40915994e-01, 4.93992723e-01, 7.32095156e-01, 4.05009684e-01,
5.51598735e-01, 9.09226150e-01, 1.32018891e-02, 4.61601703e-02,
4.12040962e-01, 1.01001565e-01, 3.62655441e-01, 9.84600099e-04,
3.76130960e+00, 2.08384510e+00, 1.42112830e-01, 1.72676129e+00])
In [0]:
#array of cdf values
cdf_samples=1-np.exp(-2*samples)
In [0]:
plt.hist(cdf_samples,bins=30,density=True)
plt.show()