2014.02.05 09:36

# 组合数学 - MetaTrader 5程序库

471

1)第一函数:

```//+------------------------------------------------------------------+
//|                     数的阶乘                                      |
//+------------------------------------------------------------------+
double factorial(int x);```

2)第二函数:

```//+------------------------------------------------------------------+
//|                 组合 (组合)                                       |
//+------------------------------------------------------------------+
double combination(int N,int k);```

C(k,N) = C(3,10) = 120.

3)第三函数:

```//+------------------------------------------------------------------+
//|            组合 (组合) 与重复                                      |
//+------------------------------------------------------------------+
double _combination(int N,int k);```

~C(k,N) = ~C(3,10) = 220.

4)第四函数:

```//+------------------------------------------------------------------+
//|                        顺序排列                                   |
//+------------------------------------------------------------------+
double arrangement(int N,int k);```

A(k,N) = A(3,10) = 720.

5)第五函数:

```//+------------------------------------------------------------------+
//|                   重复顺序排列                                     |
//+------------------------------------------------------------------+
double _arrangement(int N,int k);```

~A(k,N) = ~A(3,10) = 1000.

6)第六函数:

```//+------------------------------------------------------------------+
//|                       排列                                        |
//+------------------------------------------------------------------+
double permutation(int N);```

P(N) = P(10) = 3 628 800.

P(3) = 6.

7)第七函数:

```//+------------------------------------------------------------------+
//|                  重复排列                                         |
//+------------------------------------------------------------------+
double _permutation(int &nM[]);```

Only 作为参数传递一个数组, 其中每个元素指示可以重复多少次。

~P(N) = ~P({1,1,1}) = 6.

I.e. ~P({1,1,1}) = P(3).

~P({2,1,1}) = 12.

MALR

TEMA Band

EA_MALR