add more help text
This commit is contained in:
@@ -58,10 +58,24 @@ func stirling(cmd *cobra.Command, args []string) {
|
||||
|
||||
// stirlingCmd represents the stirling command
|
||||
var stirlingCmd = &cobra.Command{
|
||||
Use: "stirling",
|
||||
Use: "stirling [-1|-2] -n N -k N",
|
||||
Short: "Compute the Stirling numbers",
|
||||
Long: `Compute the Stirling numbers.`,
|
||||
Run: stirling,
|
||||
Long: `Compute the Stirling numbers.
|
||||
|
||||
The Stirling numbers of the first kind give the coefficients in the expansion of the falling factorial. For example,
|
||||
x(x-1)(x-2) = x^3 - 3x^2 + 2x
|
||||
Consequently, s(3,1) = 2, s(3,2) = -3, and s(3,3) = 3.
|
||||
|
||||
The Stirling numbers of the second kind count the number of ways to partition a set of n objects into k non-empty subsets. For example, there are 7 ways to partition a set of 4 objects into 2 non-empty subsets:
|
||||
{1} {2,3,4}
|
||||
{2} {1,3,4}
|
||||
{3} {1,2,4}
|
||||
{4} {1,2,3}
|
||||
{1,2} {3,4}
|
||||
{1,3} {2,4}
|
||||
{1,4} {2,3}
|
||||
Therefore S(4,2) = 7.`,
|
||||
Run: stirling,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user