Factorial in Wolfram Mathematica
Example for versions
Wolfram Mathematica 8.0.4
This example uses recursive factorial definition. The first line defines Fact
function. Note that the names of function arguments must have an underscore _
appended to them.
Fact[n_] := If[n == 0, 1, Fact[n - 1]*n];
For[i = 0, i <= 16, i++, Print[i, "! = ", Fact[i]]];
Comments
]]>blog comments powered by Disqus
]]>