Create a geometric distributionΒΆ

In this example we are going to create a geometric distribution with parameter p = 0.7.

from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)

distribution = ot.Geometric(0.7)
print(distribution)

Out:

Geometric(p = 0.7)
sample = distribution.getSample(10)
print(sample)

Out:

    [ X0 ]
0 : [ 3  ]
1 : [ 2  ]
2 : [ 1  ]
3 : [ 2  ]
4 : [ 3  ]
5 : [ 1  ]
6 : [ 1  ]
7 : [ 3  ]
8 : [ 3  ]
9 : [ 1  ]
graph = distribution.drawCDF()
view = viewer.View(graph)
plt.show()
X0 CDF

Total running time of the script: ( 0 minutes 0.068 seconds)

Gallery generated by Sphinx-Gallery