How to plot multifactorial function?
The immediate cure is to instead use the Chebyshev polynomial of the second kind, $U_n(x)$, in the definition:
multiFactorial[x_, k_] := k^(x/k) Gamma[1 + x/k] Product[((j k^(-(j/k)))/Gamma[(j + k)/k])^
(Cos[(π (-j + x))/k]/k
ChebyshevU[k - 1, Cos[(π (-j + x))/k]]),
{j, 1, k - 1}]
For instance:
multiFactorial[x, 2] - x!! // FunctionExpand // Simplify
0
Plot[multiFactorial[x, 5], {x, -4, 4}]
Clear["Global`*"]
$Version
(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)
Treat the case for integer x
as a limit.
Edited to match revised question
Multifactorial[x_Integer, k_Integer?Positive] := Module[{z},
Limit[k^(z/k)*Gamma[1 + z/k]*
Product[((j k^(-(j/k)))/Gamma[(j + k)/k])^(1/k*
Sin[Pi (z - j)] Cot[Pi*(z - j)/k]), {j, 1, k - 1}], z -> x]]
Multifactorial[x_, k_Integer?Positive] :=
k^(x/k)*Gamma[1 + x/k]*
Product[((j k^(-(j/k)))/Gamma[(j + k)/k])^(1/k*
Sin[Pi (x - j)] Cot[Pi*(x - j)/k]), {j, 1, k - 1}]
Multifactorial[2, 5]
(* 2 *)
Multifactorial[2 - 10^-10, 5] // N
(* 2. *)
Multifactorial[2 + 10^-10, 5] // N
(* 2. *)
Show[
Plot[Multifactorial[x, 5], {x, -4, 4}],
DiscretePlot[Multifactorial[x, 5], {x, -4, 4}]]
There are still issues if you enter an integer as a real, e.g.,
Multifactorial[2., 5]
(* Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.
Indeterminate *)
However, you can resolve this by rationalizing the input.
Multifactorial[2. // Rationalize, 5]
(* 2 *)