1%feature("docstring") OT::Trapezoidal
2"Trapezoidal distribution.
3
4Available constructors:
5    Trapezoidal(*a=-2.0, b=-1.0, c=1.0, d=2.0*)
6
7Parameters
8----------
9a : float, :math:`a < d`
10    Lower bound.
11b : float, :math:`a \leq b < c`
12    Level start.
13c : float, :math:`b < c \leq d`
14    Level end.
15d : float, :math:`c \leq d`
16    Upper bound.
17
18Notes
19-----
20Its probability density function is defined as:
21
22.. math::
23
24    f_X(x) = \left\{
25                 \begin{array}{ll}
26                 \displaystyle h \frac{x - a}{b - a} & a \leq x < b \\
27                 \displaystyle h                     & b \leq x < c \\
28                 \displaystyle h \frac{d - x}{d - c} & c \leq x \leq d \\
29                 \end{array}
30             \right., \quad x \in [a, d]
31
32with: :math:`h=\frac{2}{d+c-a-b}`
33
34Its first moments are:
35
36.. math::
37    :nowrap:
38
39    \begin{eqnarray*}
40        \Expect{X} & = & \frac{h}{6}(d^2 + cd + c^2 - b^2 - ab - a^2)  \\
41        \Var{X} & = &  \frac{h^2}{72}(d^4 + 2cd^3 - 3bd^3 - 3ad^3 ...\\
42                    & & - 3bcd^2 - 3acd^2 + 4b^2d^2 + 4abd^2 ...\\
43                    & & + 4a^2d^2 + 2c^3d - 3bc^2d - 3ac^2d ...\\
44                    & & + 4b^2cd + 4abcd + 4a^2cd - 3b^3d - 3ab^2d ...\\
45                    & & - 3a^2bd - 3a^3d + c^4 - 3bc^3 - 3ac^3 + 4b^2c^2 ...\\
46                    & & + 4abc^2 + 4a^2c^2 - 3b^3c - 3ab^2c - 3a^2bc ...\\
47                    & & - 3a^3c + b^4 + 2ab^3 + 2a^3b + a^4)
48    \end{eqnarray*}
49
50Examples
51--------
52Create a distribution:
53
54>>> import openturns as ot
55>>> distribution = ot.Trapezoidal(1.0, 2.3, 4.5, 5.0)
56
57Draw a sample:
58
59>>> sample = distribution.getSample(5)"
60
61// ---------------------------------------------------------------------
62
63%feature("docstring") OT::Trapezoidal::getA
64"Accessor to the distribution's lower bound.
65
66Returns
67-------
68a : float
69    Lower bound."
70
71// ---------------------------------------------------------------------
72
73%feature("docstring") OT::Trapezoidal::getB
74"Accessor to the distribution's level start.
75
76Returns
77-------
78b : float
79    Level start."
80
81// ---------------------------------------------------------------------
82
83%feature("docstring") OT::Trapezoidal::getC
84"Accessor to the distribution's level end.
85
86Returns
87-------
88c : float
89    Level end."
90
91// ---------------------------------------------------------------------
92
93%feature("docstring") OT::Trapezoidal::getD
94"Accessor to the distribution's upper bound.
95
96Returns
97-------
98d : float
99    Upper bound."
100
101// ---------------------------------------------------------------------
102
103%feature("docstring") OT::Trapezoidal::setA
104"Accessor to the distribution's lower bound.
105
106Returns
107-------
108a : float, :math:`a \leq b < c \leq d`
109    Lower bound."
110
111// ---------------------------------------------------------------------
112
113%feature("docstring") OT::Trapezoidal::setB
114"Accessor to the distribution's level start.
115
116Returns
117-------
118b : float, :math:`a \leq b < c \leq d`
119    Level start."
120
121// ---------------------------------------------------------------------
122
123%feature("docstring") OT::Trapezoidal::setC
124"Accessor to the distribution's level end.
125
126Returns
127-------
128c : float, :math:`a \leq b < c \leq d`
129    Level end."
130
131// ---------------------------------------------------------------------
132
133%feature("docstring") OT::Trapezoidal::setD
134"Accessor to the distribution's upper bound.
135
136Returns
137-------
138d : float, :math:`a \leq b < c \leq d`
139    Upper bound."
140
141