Previous Page Next Page Contents

binomial -- binomial coefficients

Introduction

binomial(n, k) represents the binomial coefficient n!/k!/(n-k)!.

Call(s)

binomial(n, k)

Parameters

n, k - arithmetical expressions

Returns

an arithmetical expression.

Side Effects

When called with floating point arguments, the function is sensitive to the environment variable DIGITS which determines the numerical working precision.

Related Functions

fact, gamma

Details

Example 1

We demonstrate some calls with exact and symbolic input data:

>> binomial(10, k) $ k=-2..12
         0, 0, 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, 0, 0
>> binomial(-23/12, 3), binomial(1 + I, 3) 
                           -37835/10368, - 1/3 I
>> binomial(n, k), binomial(n, 1), binomial(n, 4)
                     binomial(n, k), n, binomial(n, 4)

Floating point values are computed for floating point arguments:

>> binomial(-235/123, 3.0), binomial(3.0, 1 + I)
                 -3.624343742, 4.411293493 + 2.205646746 I

Example 2

The expand function handles expressions involving binomial:

>> binomial(n, 3) = expand(binomial(n, 3))
                                             2    3
                                        n   n    n
                       binomial(n, 3) = - - -- + --
                                        3   2    6
>> binomial(2, k) = expand(binomial(2, k))
                                              2
         binomial(2, k) = - -------------------------------------
                             2
                            k  gamma(k) gamma(-k) (1 - k) (2 - k)

The float attribute handles binomial if all arguments can be converted to floating point numbers:

>> binomial(sin(3), 5/4), float(binomial(sin(3), 5/4))
                   binomial(sin(3), 5/4), -0.08360571366

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000