TransWikia.com

How to plot multifactorial function?

Mathematica Asked by Mariusz Iwaniuk on March 23, 2021

The multifactorial function can be extended to the reals (see TheSimpliFire answer) like so:

It follows that we can extend the multifactorial function to the reals through

$$x!^{(k)}=k^{x/k}Gammaleft(1+frac{x}{k}right)prod_{i=1}^{k-1}left(frac{i k^{-i/k}}{Gamma(1+i/k)}right)^{sin(pi(x-i))cot(pi(x-i)/k)/k}$$

Multifactorial[x_, k_] := 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]
(*Error messages: "Indeterminate expression 0^0 encountered"*)

Plot[Multifactorial[x, 5], {x, -4, 4}]

How can get to work and plot (with Desmos, it works fine) the function?

2 Answers

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}]

plot of 5-factorial

Correct answer by J. M.'s ennui on March 23, 2021

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}]]

enter image description here

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 *)

Answered by Bob Hanlon on March 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP