Can Factorial[] be compiled?

• To: mathgroup at smc.vnet.net
• Subject: [mg14990] Can Factorial[] be compiled?
• From: Wagner Truppel <wtruppel at uci.edu>
• Date: Wed, 2 Dec 1998 03:59:10 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```Hello again,

I'm trying to compile the function below, but Mathematica refuses to
compile the i!; notice the term

{31, Function[{m, n}, i!], {i, 3, 0, 15, Block}, 3, 0, 19}

in the InputForm of the compiled function. Does anyone have a suggestion
on  how to fix this?

Wagner Truppel

f = Compile[{{m, _Real}, {n, _Real}}, Sum[(m^i*Sqrt[i])/i!, {i, 1.0, n,
1.0}]/E^m];

InputForm[f]

InputForm[CompiledFunction[{_Real, _Real}, {0, 5, 21, 0, 2}, {{1, 2},
{4,  1, 0}, {4, 2, 1}, {42, 0, 2}, {53, 2, 3}, {15, 1., 13}, {15, 1.,
14}, {14,  1, 2}, {42, 13, 15}, {34, 1, 15, 15}, {45, 14, 16}, {38, 15,
16, 15}, {83,  15, 3}, {33, 2, 3, 2}, {108, 2, 1, 3, 1}, {14, 0, 3},
{24, 3, 17}, {38, 17,  14, 17}, {34, 13, 17, 17}, {20, 17, 15}, {131,
3, 2, 8}, {50, 0, 15, 17},  {52, 15, 18}, {31, Function[{m, n}, i!],
{i, 3, 0, 15, Block}, 3, 0, 19},  {45, 19, 20}, {38, 17, 18, 20, 17},
{109, 17, 1}, {91, -11}, {15, 0, 11},  {107, 1, 3}, {14, 0, 4}, {131,
4, 3, 5}, {114, 1, 4, 12}, {34, 11, 12, 12},  {20, 12, 11}, {91, -4},
{38, 3, 11, 2}, {9, 2}}, Function[{m, n},  Sum[(m^i*Sqrt[i])/i!, {i,
1.0, n, 1.0}]/E^m]]]

```

• Prev by Date: RE: [Q] Factoring arrays
• Next by Date: Re: Fourier Transform PDF Characteristic Function
• Previous by thread: RE: [Q] Factoring arrays
• Next by thread: RE: Can Factorial[] be compiled?