SlideShare a Scribd company logo
1 of 8
Download to read offline
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm,binom,poisson,uniform,expon
from math import sqrt,exp
####Loi uniforme
N = 100
a = 0
b = 5
t=0.5
v = (exp(t*b)-exp(t*a))/(t*(b-a))
u = (a+b)/2
sigma = ((b-a)**2)/12
s = np.random.uniform(a,b,N)
def uni(k,N,s):
x3,x4 = 0,0
for i in range(N):
if np.abs(s[i]-u)>= k:
x3 += 1
x4=x3/N
return x4
def uni2(k,N,s):
x2 = 0
x1 = 0
for i in range(N):
if s[i]>= k:
x1 += 1
x2 = x1/N
return x2
xlist=np.arange(0.5,5,0.01)
def chebyshev(u,sigma,k):
return sigma/k**2
chebylist=[]
def markov(u,k):
return u/k
markovlist=[]
def chernoff(v,k,t):
return v/exp(t*k)
chernofflist = []
pklist = []
difflist= []
difflist2= []
difflist3= []
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
chernofflist.append(chernoff(v,k,t))
pklist.append(uni(k,N,s))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
uniflist = uniform.sf(xlist,a,b)
#plt.plot(xlist,uniflist,label= 'Loi uniforme([{},{}])'.format(a,b))
#plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
#plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff')
#plt.xlabel('k')
#plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,label = 'Loi uniforme([{},{}])'.format(a,b))
#plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
###### Loi de Bernoulli
N = 100
n = 1
p = 0.5
t=1
u = n*p
sigma = n*p*(1-p)
s = np.random.binomial(n,p,N)
xlist=np.arange(0.5,50,1)
v = (exp(t)*p + (1-p))**n
chernofflist = []
chebylist=[]
markovlist=[]
pklist = []
difflist= []
difflist2= []
difflist3= []
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
chernofflist.append(chernoff(v,k,t))
pklist.append(uni(k,N,s))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
bernlist = binom.sf(xlist,1,p)
plt.plot(xlist,bernlist,label = 'Loi de Bernoulli({})'.format(p))
plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff')
#plt.xlabel('k')
#plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,'Loi de Bernoulli({})'.format(p))
#plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
#plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
#plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
#plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
############ Loi Binomiale
N = 100
n = 10
p = 0.5
t=0.5
u = n*p
sigma = n*p*(1-p)
v = (exp(t)*p + (1-p))**n
s = np.random.binomial(n,p,N)
xlist=np.arange(0.5,50,1)
chernofflist = []
chebylist=[]
markovlist=[]
pklist = []
difflist3=[]
difflist= []
difflist2= []
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
chernofflist.append(chernoff(v,k,t))
pklist.append(uni(k,N,s))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
binomlist = binom.sf(xlist,n,p)
plt.plot(xlist,binomlist,label='Loi Binomiale({},{})'.format(n,p))
plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff')
#plt.xlabel('k')
#plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,label='Loi Binomiale({},{})'.format(n,p))
#plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
#plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
#plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
#plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
###### Loi de Poisson
N = 100
lam = 0.3
t=1
u = lam
sigma = lam**2
s = np.random.poisson(lam,N)
v = exp(lam*(exp(t)-1))
xlist=np.arange(0.5,10,0.01)
chebylist=[]
markovlist=[]
pklist = []
chernofflist = []
difflist= []
difflist2= []
difflist3= []
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
chernofflist.append(chernoff(v,k,t))
pklist.append(uni(k,N,s))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
poisslist = poisson.sf(xlist,u)
plt.plot(xlist,poisslist,label= 'Loi de Poisson({})'.format(lam))
plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
#plt.plot(xlist,chernofflist,label='Inégalité de Chernoff')
#plt.xlabel('k')
#plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,label='Loi de Poisson({})'.format(lam))
#plt.plot(xlist,chebylist,label='Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
#plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
#plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
#plt.plot(xlis,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
##### Loi exponentille
N = 100
lam = 2
#t>lam
t=3
u = 1/lam
sigma = 1/lam**2
s = np.random.exponential(u,N)
v=lam/(t-lam)
xlist=np.arange(0.5,10,0.01)
explist = expon.sf(xlist,u)
chebylist=[]
markovlist=[]
chernofflist=[]
pklist = []
difflist= []
difflist2= []
difflist3=[]
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
pklist.append(uni(k,N,s))
chernofflist.append(chernoff(v,k,t))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
plt.plot(xlist,explist,label='Loi Exponentielle({})'.format(lam))
plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff')
plt.xlabel('k')
plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,label = 'Loi Exponentielle({})'.format(lam))
#plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
#plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
#plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
#plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
#############"" Loi normale standard
N = 100
u=0
sigma=1
s = np.random.normal(u,sigma,N)
t=1
xlist=np.arange(0.5,5,0.01)
v = exp(-u*t-0.5*sigma*(t**2))
chebylist=[]
markovlist=[]
chernofflist=[]
pklist = []
difflist= []
difflist2= []
difflist3=[]
for k in xlist:
chebylist.append(chebyshev(u,sigma,k))
markovlist.append(markov(u,k))
pklist.append(uni(k,N,s))
chernofflist.append(chernoff(v,k,t))
difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k)))
difflist2.append(np.abs(uni2(k,N,s)-markov(u,k)))
difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t)))
normlist = norm.sf(xlist,u)
plt.plot(xlist,normlist,label = 'Loi Normale({},{})'.format(u,sigma))
plt.plot(xlist,markovlist,label = 'Inégalité de Markov')
plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff')
#plt.xlabel('k')
#plt.ylabel('P(X>k)')
#plt.plot(xlist,pklist,label='Loi Normale({},{})'.format(u,sigma))
#plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev')
#plt.xlabel('k')
#plt.ylabel('P(|X-E(X)|>k)')
#plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev')
#plt.plot(xlist,difflist2,label = 'Inégalité de Markov')
#plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff')
#plt.ylabel('Valeur de l'erreur')
#plt.xlabel('k')
plt.legend()
plt.show()
Pdfcode

More Related Content

What's hot

Bellman ford
Bellman fordBellman ford
Bellman fordKiran K
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow TutorialNamHyuk Ahn
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plottingAmr Rashed
 
Topic: Fourier Series ( Periodic Function to change of interval)
Topic: Fourier Series ( Periodic Function to  change of interval)Topic: Fourier Series ( Periodic Function to  change of interval)
Topic: Fourier Series ( Periodic Function to change of interval)Abhishek Choksi
 
Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Traian Rebedea
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonshin
 
Program implementation and testing
Program implementation and testingProgram implementation and testing
Program implementation and testingabukky52
 
6. graphs of trig functions x
6. graphs of trig functions x6. graphs of trig functions x
6. graphs of trig functions xharbormath240
 

What's hot (19)

CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
CLIM Undergraduate Workshop: (Attachment) Performing Extreme Value Analysis (...
 
Python hmm
Python hmmPython hmm
Python hmm
 
Bellman ford
Bellman fordBellman ford
Bellman ford
 
Calculus III
Calculus IIICalculus III
Calculus III
 
About RNN
About RNNAbout RNN
About RNN
 
About RNN
About RNNAbout RNN
About RNN
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow Tutorial
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
 
Python Tidbits
Python TidbitsPython Tidbits
Python Tidbits
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
 
Topic: Fourier Series ( Periodic Function to change of interval)
Topic: Fourier Series ( Periodic Function to  change of interval)Topic: Fourier Series ( Periodic Function to  change of interval)
Topic: Fourier Series ( Periodic Function to change of interval)
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
 
Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluiton
 
Program implementation and testing
Program implementation and testingProgram implementation and testing
Program implementation and testing
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
6. graphs of trig functions x
6. graphs of trig functions x6. graphs of trig functions x
6. graphs of trig functions x
 

Similar to Pdfcode

On the smallest enclosing information disk
 On the smallest enclosing information disk On the smallest enclosing information disk
On the smallest enclosing information diskFrank Nielsen
 
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
Implement the following sorting algorithms  Bubble Sort  Insertion S.pdfImplement the following sorting algorithms  Bubble Sort  Insertion S.pdf
Implement the following sorting algorithms Bubble Sort Insertion S.pdfkesav24
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileKushagraChadha1
 
University of manchester mathematical formula tables
University of manchester mathematical formula tablesUniversity of manchester mathematical formula tables
University of manchester mathematical formula tablesGaurav Vasani
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture gVlad Patryshev
 
Agda であそぼ
Agda であそぼAgda であそぼ
Agda であそぼerutuf13
 
A Note on the Derivation of the Variational Inference Updates for DILN
A Note on the Derivation of the Variational Inference Updates for DILNA Note on the Derivation of the Variational Inference Updates for DILN
A Note on the Derivation of the Variational Inference Updates for DILNTomonari Masada
 
DSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docxDSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docxMUMAR57
 
Slides: The Burbea-Rao and Bhattacharyya centroids
Slides: The Burbea-Rao and Bhattacharyya centroidsSlides: The Burbea-Rao and Bhattacharyya centroids
Slides: The Burbea-Rao and Bhattacharyya centroidsFrank Nielsen
 
Add math may june 2016 p1
Add math may june 2016 p1Add math may june 2016 p1
Add math may june 2016 p1Don Cunningham
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...Revolution Analytics
 
Lecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsLecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsStéphane Canu
 

Similar to Pdfcode (20)

Codecomparaison
CodecomparaisonCodecomparaison
Codecomparaison
 
On the smallest enclosing information disk
 On the smallest enclosing information disk On the smallest enclosing information disk
On the smallest enclosing information disk
 
NCM LECTURE NOTES ON LATIN SQUARES(27) (1) (1)
NCM LECTURE NOTES ON LATIN SQUARES(27) (1) (1)NCM LECTURE NOTES ON LATIN SQUARES(27) (1) (1)
NCM LECTURE NOTES ON LATIN SQUARES(27) (1) (1)
 
NCM LECTURE NOTES ON LATIN SQUARES(27)
NCM LECTURE NOTES ON LATIN SQUARES(27)NCM LECTURE NOTES ON LATIN SQUARES(27)
NCM LECTURE NOTES ON LATIN SQUARES(27)
 
Lambda calculus
Lambda calculusLambda calculus
Lambda calculus
 
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
Implement the following sorting algorithms  Bubble Sort  Insertion S.pdfImplement the following sorting algorithms  Bubble Sort  Insertion S.pdf
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical File
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
University of manchester mathematical formula tables
University of manchester mathematical formula tablesUniversity of manchester mathematical formula tables
University of manchester mathematical formula tables
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture g
 
Agda であそぼ
Agda であそぼAgda であそぼ
Agda であそぼ
 
A Note on the Derivation of the Variational Inference Updates for DILN
A Note on the Derivation of the Variational Inference Updates for DILNA Note on the Derivation of the Variational Inference Updates for DILN
A Note on the Derivation of the Variational Inference Updates for DILN
 
purrr.pdf
purrr.pdfpurrr.pdf
purrr.pdf
 
DSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docxDSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docx
 
Slides: The Burbea-Rao and Bhattacharyya centroids
Slides: The Burbea-Rao and Bhattacharyya centroidsSlides: The Burbea-Rao and Bhattacharyya centroids
Slides: The Burbea-Rao and Bhattacharyya centroids
 
Math report
Math reportMath report
Math report
 
Add math may june 2016 p1
Add math may june 2016 p1Add math may june 2016 p1
Add math may june 2016 p1
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
 
Lecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsLecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhs
 
Cse41
Cse41Cse41
Cse41
 

Recently uploaded

AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 

Recently uploaded (20)

AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 

Pdfcode

  • 1. import matplotlib.pyplot as plt import numpy as np from scipy.stats import norm,binom,poisson,uniform,expon from math import sqrt,exp ####Loi uniforme N = 100 a = 0 b = 5 t=0.5 v = (exp(t*b)-exp(t*a))/(t*(b-a)) u = (a+b)/2 sigma = ((b-a)**2)/12 s = np.random.uniform(a,b,N) def uni(k,N,s): x3,x4 = 0,0 for i in range(N): if np.abs(s[i]-u)>= k: x3 += 1 x4=x3/N return x4 def uni2(k,N,s): x2 = 0 x1 = 0 for i in range(N): if s[i]>= k: x1 += 1 x2 = x1/N return x2 xlist=np.arange(0.5,5,0.01) def chebyshev(u,sigma,k): return sigma/k**2 chebylist=[] def markov(u,k): return u/k markovlist=[] def chernoff(v,k,t): return v/exp(t*k) chernofflist = [] pklist = [] difflist= [] difflist2= []
  • 2. difflist3= [] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) chernofflist.append(chernoff(v,k,t)) pklist.append(uni(k,N,s)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) uniflist = uniform.sf(xlist,a,b) #plt.plot(xlist,uniflist,label= 'Loi uniforme([{},{}])'.format(a,b)) #plt.plot(xlist,markovlist,label = 'Inégalité de Markov') #plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff') #plt.xlabel('k') #plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,label = 'Loi uniforme([{},{}])'.format(a,b)) #plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') plt.plot(xlist,difflist2,label = 'Inégalité de Markov') plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show() ###### Loi de Bernoulli N = 100 n = 1 p = 0.5 t=1 u = n*p sigma = n*p*(1-p) s = np.random.binomial(n,p,N) xlist=np.arange(0.5,50,1) v = (exp(t)*p + (1-p))**n chernofflist = []
  • 3. chebylist=[] markovlist=[] pklist = [] difflist= [] difflist2= [] difflist3= [] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) chernofflist.append(chernoff(v,k,t)) pklist.append(uni(k,N,s)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) bernlist = binom.sf(xlist,1,p) plt.plot(xlist,bernlist,label = 'Loi de Bernoulli({})'.format(p)) plt.plot(xlist,markovlist,label = 'Inégalité de Markov') plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff') #plt.xlabel('k') #plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,'Loi de Bernoulli({})'.format(p)) #plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') #plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') #plt.plot(xlist,difflist2,label = 'Inégalité de Markov') #plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show() ############ Loi Binomiale N = 100 n = 10 p = 0.5 t=0.5 u = n*p sigma = n*p*(1-p) v = (exp(t)*p + (1-p))**n
  • 4. s = np.random.binomial(n,p,N) xlist=np.arange(0.5,50,1) chernofflist = [] chebylist=[] markovlist=[] pklist = [] difflist3=[] difflist= [] difflist2= [] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) chernofflist.append(chernoff(v,k,t)) pklist.append(uni(k,N,s)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) binomlist = binom.sf(xlist,n,p) plt.plot(xlist,binomlist,label='Loi Binomiale({},{})'.format(n,p)) plt.plot(xlist,markovlist,label = 'Inégalité de Markov') plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff') #plt.xlabel('k') #plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,label='Loi Binomiale({},{})'.format(n,p)) #plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') #plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') #plt.plot(xlist,difflist2,label = 'Inégalité de Markov') #plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show() ###### Loi de Poisson N = 100 lam = 0.3 t=1 u = lam sigma = lam**2
  • 5. s = np.random.poisson(lam,N) v = exp(lam*(exp(t)-1)) xlist=np.arange(0.5,10,0.01) chebylist=[] markovlist=[] pklist = [] chernofflist = [] difflist= [] difflist2= [] difflist3= [] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) chernofflist.append(chernoff(v,k,t)) pklist.append(uni(k,N,s)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) poisslist = poisson.sf(xlist,u) plt.plot(xlist,poisslist,label= 'Loi de Poisson({})'.format(lam)) plt.plot(xlist,markovlist,label = 'Inégalité de Markov') #plt.plot(xlist,chernofflist,label='Inégalité de Chernoff') #plt.xlabel('k') #plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,label='Loi de Poisson({})'.format(lam)) #plt.plot(xlist,chebylist,label='Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') #plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') #plt.plot(xlist,difflist2,label = 'Inégalité de Markov') #plt.plot(xlis,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show() ##### Loi exponentille N = 100 lam = 2
  • 6. #t>lam t=3 u = 1/lam sigma = 1/lam**2 s = np.random.exponential(u,N) v=lam/(t-lam) xlist=np.arange(0.5,10,0.01) explist = expon.sf(xlist,u) chebylist=[] markovlist=[] chernofflist=[] pklist = [] difflist= [] difflist2= [] difflist3=[] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) pklist.append(uni(k,N,s)) chernofflist.append(chernoff(v,k,t)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) plt.plot(xlist,explist,label='Loi Exponentielle({})'.format(lam)) plt.plot(xlist,markovlist,label = 'Inégalité de Markov') plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff') plt.xlabel('k') plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,label = 'Loi Exponentielle({})'.format(lam)) #plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') #plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') #plt.plot(xlist,difflist2,label = 'Inégalité de Markov') #plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show()
  • 7. #############"" Loi normale standard N = 100 u=0 sigma=1 s = np.random.normal(u,sigma,N) t=1 xlist=np.arange(0.5,5,0.01) v = exp(-u*t-0.5*sigma*(t**2)) chebylist=[] markovlist=[] chernofflist=[] pklist = [] difflist= [] difflist2= [] difflist3=[] for k in xlist: chebylist.append(chebyshev(u,sigma,k)) markovlist.append(markov(u,k)) pklist.append(uni(k,N,s)) chernofflist.append(chernoff(v,k,t)) difflist.append(np.abs(uni(k,N,s)-chebyshev(u,sigma,k))) difflist2.append(np.abs(uni2(k,N,s)-markov(u,k))) difflist3.append(np.abs(uni2(k,N,s)-chernoff(v,k,t))) normlist = norm.sf(xlist,u) plt.plot(xlist,normlist,label = 'Loi Normale({},{})'.format(u,sigma)) plt.plot(xlist,markovlist,label = 'Inégalité de Markov') plt.plot(xlist,chernofflist,label = 'Inégalité de Chernoff') #plt.xlabel('k') #plt.ylabel('P(X>k)') #plt.plot(xlist,pklist,label='Loi Normale({},{})'.format(u,sigma)) #plt.plot(xlist,chebylist,label = 'Inégalité de Chebyshev') #plt.xlabel('k') #plt.ylabel('P(|X-E(X)|>k)') #plt.plot(xlist,difflist,label = 'Inégalité de Chebyshev') #plt.plot(xlist,difflist2,label = 'Inégalité de Markov') #plt.plot(xlist,difflist3,label = 'Inégalité de Chernoff') #plt.ylabel('Valeur de l'erreur') #plt.xlabel('k') plt.legend() plt.show()