User Tools

Site Tools


factorials

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
factorials [2014/04/05 04:29]
127.0.0.1 external edit
factorials [2014/05/24 04:34] (current)
Jay.Tanner.x@PHPScienceLabs.us
Line 1: Line 1:
 ~~NOCACHE~~ ~~NOCACHE~~
 ~~DISCUSSION:​off~~ ~~DISCUSSION:​off~~
 +Back to:  **[[INDEX]]** ​ |  **[[Arbitrary-Precision Math]]**
 +-----
 =====Factorials===== =====Factorials=====
  
Line 9: Line 11:
 **Mathematically,​ the factorial of integer N is simply the product of all the sequential integers from 1 to N multiplied together. ​ Zero factorial equates to 1, by definition. ​ Physically, N factorial represents a count of the total number of possible unique linear sequences (permutations) we can make using N distinct items.** **Mathematically,​ the factorial of integer N is simply the product of all the sequential integers from 1 to N multiplied together. ​ Zero factorial equates to 1, by definition. ​ Physically, N factorial represents a count of the total number of possible unique linear sequences (permutations) we can make using N distinct items.**
 \\ \\ \\ \\
 +**[[Factorial Calculator]]** based on the function defined below.
 +\\
 +-----
 With factorial permutations,​ the only thing that matters is the sequential order of the items. ​ For example, there are 6 unique permutations of 3 people, which is to say that there are (3 x 2 x 1) = 6 ways that 3 people can be lined up in a row. There are (5 x 4 x 3 x 2 x 1) = 120 permutations of 5 people or 120 possible different sequences in which 5 people can be lined up in a row, etc. With factorial permutations,​ the only thing that matters is the sequential order of the items. ​ For example, there are 6 unique permutations of 3 people, which is to say that there are (3 x 2 x 1) = 6 ways that 3 people can be lined up in a row. There are (5 x 4 x 3 x 2 x 1) = 120 permutations of 5 people or 120 possible different sequences in which 5 people can be lined up in a row, etc.
 \\ \\ \\ \\
Line 85: Line 90:
  
 // Print out the computed table. // Print out the computed table.
-   print "<​b><​pre>​\nN ​  ​N!\n$FactorialTable</​pre></​b>​\n<​br><​br><​br>​"; +   print "<​b><​pre>​\nN ​  ​N!\n$FactorialTable</​pre></​b>​\n";​
- +
- +
-// =========================================================== +
-   ​function bcN_Factorial ($N=0) +
-+
-   $n = bcadd($N, 0); +
-    +
-   if (!is_numeric($n) or $n < 0 or $n > 9999) {return FALSE;} +
-    +
-   ​$P=1; ​ for ($i=1; ​ $i <= $n;  $i++) {$P = bcmul($P, $i);} +
-    +
-   ​return $P; +
-}+
  
 ?> ?>
Line 131: Line 123:
 // Print out the computed table. // Print out the computed table.
  
-   print "<​b><​pre>​\nN ​  ​N!\n$out</​pre></​b>​\n<​br><​br><​br>​";+   print "<​b><​pre>​\nN ​  ​N!\n$out</​pre></​b>​\n";​
  
- 
-   ​function bcN_Factorial ($N=0) 
-{ 
-   if (!is_numeric($N) or $N < 0 or $N > 9999) {return FALSE;} 
- 
-   $n = bcadd($N, 0); 
- 
-   ​$P=1; ​ for ($i=1; ​ $i <= $n;  $i++) {$P = bcmul($P, $i);} 
- 
-   ​return $P; 
-} 
 </​php>​ </​php>​
-**By examining the above table, ​you can see how rapidly the values of factorials increase.** +**By examining the above table, ​one can see how rapidly the values of factorials increase.**
-\\ \\ +
-Here is a complete program built around the factorial function defined above.\\ +
-(Tries to open in a new tab). +
-\\ +
-**[[http://​phpsciencelabs.us/​factorial_calculator/​]]**+
 \\ \\ \\ \\
 +
  
factorials.1396686571.txt.gz · Last modified: 2014/04/05 04:46 (external edit)