I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.28
sub units 0.12
+
0

log binomial

Calculates the logarithm of the binomial coefficient with given arguments.
Controller: CodeCogs

Dependents

Info

Interface

C++
Excel

Log Binomial

 
doublelog_binomialintn
intk )[inline]
This function calculates the following expression

In the given example, values of this function are returned for various arguments. The algorithm is designed in such a way to permit large values of the arguments, without creating overflow errors during the calculations. The example also demonstrates this feature, with n equal to 100 and k taking values from 70 up to 80.

Example 1

#include <codecogs/maths/combinatorics/arithmetic/log_binomial.h>
#include <iostream>
#include <iomanip>
 
int main()
{
  std::cout << std::setprecision(10);
  for (int i = 70; i <= 80; i++)
  {
    std::cout << "log_binomial(100, " << i << ") = ";
    std::cout << Maths::Combinatorics::Arithmetic::log_binomial(100, i);
    std::cout << std::endl;
  }
  return 0;
}

Output

log_binomial(100, 70) = 58.64209564
log_binomial(100, 71) = 57.78061315
log_binomial(100, 72) = 56.87124286
log_binomial(100, 73) = 55.91298793
log_binomial(100, 74) = 54.9047597
log_binomial(100, 75) = 53.84536812
log_binomial(100, 76) = 52.73351061
log_binomial(100, 77) = 51.56775902
log_binomial(100, 78) = 50.34654441
log_binomial(100, 79) = 49.06813901
log_binomial(100, 80) = 47.73063481

Parameters

nthe first argument of the binomial coefficient (the number of objects)
kthe second argument of the binomial coefficient (the number of choices)

Returns

the logarithm of the binomial coefficient with given arguments n and k

Authors

Lucian Bentea (September 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.