Undocumented Mathematica functions

See also

* [What are some useful, undocumented Mathematica functions?](http://mathematica.stackexchange.com/questions/805/what-are-some-useful-undocumented-mathematica-functions)

* [Is using undocumented functionality a Bad Idea™?](http://mathematica.stackexchange.com/questions/5940/is-using-undocumented-functionality-a-bad-idea%E2%84%A2)

* [Mathematica tricks](http://web.ift.uib.no/~szhorvat/mmatricks.php)

**Caution!** There is no guarantee for the following information. They are obtained by guessing. In the future, the company may change them in an incompatible way.

**System`**

* `DuplicateFreeQ[list]` (>= v9.0)

```mma
DuplicateFreeQ[{1, 2, 3}] // Print;  (* True*)
DuplicateFreeQ[{1, 2, 1}] // Print;  (* False *)
```

* `TensorQ[expr]`

* Optional arguments of `Return[expr, func]` and `Break[func]`
(http://mathematica.stackexchange.com/a/6757)

```mma
f[x_] := Module[{},
  Do[If[x > 5, Return[a]], {3}]; x
];
f[6] // Print;  (* 6 *)

f[x_] := Module[{},
  Do[If[x > 5, Return[a, Module]], {3}]; x
];
f[6] // Print;  (* a *)
```
 
**System\`Private\`**

* `InternalSeries[f, {x, x0, n}]` (>= v5.1)

```mma
Func /: System`Private`InternalSeries[Func[x_], {x_, 0, n_Integer}] :=
  Sum[x^i, {i, 0, n}] + x^n * O[x];

Series[Func[x] / x, {x, 0, 2}] // Print;  (* 1/x + 1 + x + x^2 + O[x]^3 *)
```

**SpecialFunctions`**

Give the following a try:

```mma
?SpecialFunctions`*
```

* `HarmonicPolyLog[{m1, ..., mk}, x]` (>= v9.0)
* `FunctionExpandHarmonicPolyLog[expr]` (>= v9.0)
* `MultipleFiniteHarmonicSumS[{m1, ..., mk}, n]` (>= v9.0)
* `MultiplePolyLog[{m1, ..., mk}, {z1, ..., zk}]` (>= v9.0)
* `MultipleZetaValue[{m1, ..., mk}]` (>= v9.0)
* `ShuffleProductExpand[expr]` (>= v9.0)
* `StuffleProductExpand[expr]` (>= v9.0)

It seems that the definitions of harmonic polylogarithms and multipolylogarithms are the same as [Remiddi and Vermaseren](http://arxiv.org/abs/hep-ph/9905237) and [Vollinga and Weinzierl](http://arxiv.org/abs/hep-ph/0410259), respectively:

```mma
(* HPL 2.0, Mathematica 10.1.0 *)
<<HPL`;
HPL[{1, -2, 3, 0}, 0.7] // Print;
SpecialFunctions`HarmonicPolyLog[{1, -2, 3, 0}, 0.7] // Print;
SpecialFunctions`MultiplePolyLog[{1, -2, 3, 0}, {0.7, 1, 1, 1}] // Print;
```
```
-0.25112
-0.25112
-0.25112
```
Still the implementation is mysterious...

```mma
(* Mathematica 10.1.0 *)
Series[PolyLog[2, 1 - x], {x, 0, 1}] // Print;
Series[SpecialFunctions`HarmonicPolyLog[{2}, 1 - x] // FunctionExpand, {x, 0, 1}] // Print;
Series[SpecialFunctions`HarmonicPolyLog[{2}, 1 - x], {x, 0, 1}, Assumptions -> 0 < x < 1] // Print;
```
```mma
Pi^2/6 + (-1+Log[x]) x + O[x]^2
Pi^2/6 + (-1+Log[x]) x + O[x]^2
Pi^2/6 + (-1-2*I*Pi+Log[x]) x + O[x]^2
```

**Less known functions**

Only usage messages by `?Command` are available.

* `ArgumentCountQ[head, len, min, max]`
* `ArgumentCountQ[head, len, {m1, m2, ..., mi}]` (>= v8.0)

```mma
TwoArgFunc[a___] := Null /; ArgumentCountQ[TwoArgFunc, Length[{a}], 2, 2] && False;

TwoArgFunc[1, 2] // Print;  (* TwoArgFunc[1, 2] *)
TwoArgFunc[1, 2, 3] // Print;  (* TwoArgFunc[1, 2, 3] with an error message "TwoArgFunc::argrx: TwoArgFunc called with 3 arguments; 2 arguments are expected." *)
```

* `ListQ[expr]`

* `OptionQ[e]`

In >= v6.0, one can use `OptionsPattern` and `OptionValue` for manipulating options.

* `StringQ[expr]`