Location: PHPKode > scripts > Combinatorics > combinatorics/Combinatorics.html
<HTML>
<HEAD>
<TITLE> Combinatorics Class </TITLE>
</HEAD>
<BODY> <HR color="NAVY">
<H1><FONT COLOR="RED" > Combinatorics Class </FONT></H1>
<HR color="NAVY">
<H2><FONT COLOR="NAVY">Description:</FONT> </H2>
<FONT COLOR="NAVY">This class returns possible combinations and dispositions of objects. An interesting use of it could be  to find the best path,
both if you have to visit a certain number of cities  and if you have to touch a certain number of nodes in a network. </FONT>
<H2><FONT COLOR="NAVY">Methods:</FONT> </H2>
<TABLE BORDER="1">
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>fact($n)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns the factorial of a number. The  parameter is the integer of which you wish calculate the factorial.
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>numPerm($n)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns the number of possible permutations (n!) of n objects . The  parameter is the  number of objects (integer) for which you wish  calculate the number of possible permutations.
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>numComb($enne ,$kappa)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> Returns the number of combinations without repetitions   n!/k! (n-k)! of n object taken k by k. The first parameter is the number of objects (integer) in your universe and the second is number of objects (integer) of each combination.
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>numDisp($enne ,$kappa)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns the number of dispositions with repetitions n^k of n objects taken k by k. The first parameter is the number of objects (integer) in your universe and the second is number of objects (integer) of each disposition.
</FONT>
</TD>
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>numDispWoR($enne ,$kappa)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns the number of dispositions without repetitions n!/(n-k)! of n objects taken k by k. The first parameter is the number of objects (integer) in your universe and the second is number of objects (integer) of each disposition.
</FONT>
</TD>
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>makePermutations($my_arr)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns all the possible permutations of the objects of your universe. The parameter is an array containing the objects of your universe.
</FONT>
</TD>
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>makeCombination($my_arr, $k)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns all the possible combinations of the objects of your universe taken k by k without repetitions. The first parameter is an array containing the objects of your universe and the second is the number (integer) of objects in each combination.
</FONT>
</TD>
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>makeDisposition($my_arr, $k)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns all the possible dispositions of the objects of your universe taken k by k with repetitions. The first parameter is an array containing the objects of your universe and the second is the number (integer) of objects in each disposition.
</FONT>
</TD>
</FONT>
</TD>
</TR>
<TR><TD>
<H3><FONT COLOR="NAVY"><PRE>makeDispositionWoR($my_arr, $k)</FONT> </H3>
</TD><TD><FONT COLOR="NAVY"> This method returns all the possible dispositions of the objects of your universe taken k by k without repetitions. The first parameter is an array containing the objects of your universe and the second is the number (integer) of objects in each disposition.
</FONT>
</TD>
</FONT>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>
Return current item: Combinatorics