Home Libraries People FAQ More

##### 三角形分佈(Triangular Distribution)

`#include <boost/math/distributions/triangular.hpp>`

```namespace boost{ namespace math{
template <class RealType = double,
class Policy   = policies::policy<> >
class triangular_distribution;

typedef triangular_distribution<> triangular;

template <class RealType, class Policy>
class triangular_distribution
{
public:
typedef RealType value_type;
typedef Policy   policy_type;

triangular_distribution(RealType lower = -1, RealType mode = 0) RealType upper = 1); // Constructor.
: m_lower(lower), m_mode(mode), m_upper(upper) // Default is -1, 0, +1 triangular distribution.
// 訪問函數(Accessor functions).
RealType lower()const;
RealType mode()const;
RealType upper()const;
}; // 類 triangular_distribution

}} // namespaces
```

f(x) =

• 2(x-a)/(b-a) (c-a) for a <= x <= c
• 2(b-x)/(b-a)(b-c) for c < x <= b

##### 函數
```triangular_distribution(RealType lower = 0, RealType mode = 0 RealType upper = 1);
```

```RealType lower()const;
```

```RealType mode()const;
```

```RealType upper()const;
```

##### 實現

pdf

cdf

cdf 補集(complement)

x = sqrt((b-a)(c-a)p) + a ; 對於 p < p0

x = c ; 對於 p == p0

x = b - sqrt((b-a)(b-c)q) ; 對於 p > p0

(參考/boost/math/distributions/triangular.hpp 瞭解相關細節.)

(a + b + 3) / 3

(a2+b2+c2 - ab - ac - bc)/18

c

(參考/boost/math/distributions/triangular.hpp 瞭解相關細節).

12/5

-3/5