Chapter 15: Utilities

binomial_coefficient

Evaluates the binomial coefficient.

Synopsis

#include <imsls.h>

float imsls_f_binomial_coefficient (int n, int m)

The type double procedure is imsls_d_binomial_coefficient.

Required Arguments

int n   (Input)
First parameter of the binomial coefficient. Argument n must be nonnegative.

int m   (Input)
Second parameter of the binomial coefficient. Argument m must be nonnegative.

Return Value

The binomial coefficient

is returned.

Description

The binomial function is defined to be

with n  m  0. Also, n must not be so large that the function overflows.

Example

In this example,  is computed and printed.

#include <stdio.h>

#include <imsls.h>

 

int main()

{

    int       n = 9;

    int       m = 5;

    float     ans;

   

    ans = imsls_f_binomial_coefficient(n, m);

    printf("binomial coefficient = %.1f\n", ans);

}

Output

  

binomial coefficient = 126.0


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260