2017 © Pedro Peláez
 

library math

A set of tools around Mathematics.

image

macfja/math

A set of tools around Mathematics.

  • Saturday, October 3, 2015
  • by MacFJA
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Math library

A set of class and function around Mathematics., (*1)

What inside ?

CombinationBuilder

An utility class to create combination. The class also provide a factorial calculation., (*2)

Example and Usage

Combination

Get for 3 in 5:, (*3)

print_r(CombinationBuilder::getCombination(5, 3));

Will output:, (*4)

Array
(
    [1-2-3] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
        )

    [1-2-4] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 4
        )

    [1-2-5] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 5
        )

    [1-3-4] => Array
        (
            [0] => 1
            [1] => 3
            [2] => 4
        )

    [1-3-5] => Array
        (
            [0] => 1
            [1] => 3
            [2] => 5
        )

    [1-4-5] => Array
        (
            [0] => 1
            [1] => 4
            [2] => 5
        )

    [2-3-4] => Array
        (
            [0] => 2
            [1] => 3
            [2] => 4
        )

    [2-3-5] => Array
        (
            [0] => 2
            [1] => 3
            [2] => 5
        )

    [2-4-5] => Array
        (
            [0] => 2
            [1] => 4
            [2] => 5
        )

    [3-4-5] => Array
        (
            [0] => 3
            [1] => 4
            [2] => 5
        )

)

Or in a more compact way:, (*5)

(1, 2, 3)
(1, 2, 4)
(1, 2, 5)
(1, 3, 4)
(1, 3, 5)
(1, 4, 5)
(2, 3, 4)
(2, 3, 5)
(2, 4, 5)
(3, 4, 5)

Combination Count

Get the number of possible combination, (*6)

print_r(CombinationBuilder::getCombinationCount(5, 3));

Will output:, (*7)

10

Factorial

Get the factorial of 5 (5!), (*8)

print_r(CombinationBuilder::factorial(5));

Will output:, (*9)

120

The Versions

03/10 2015

dev-master

9999999-dev

A set of tools around Mathematics.

  Sources   Download

MIT

by Avatar MacFJA

math combination