beta.hpp

Back to Mathematical functions

pastel/sys/math/

#ifndef PASTELSYS_BETA_HPP
#define PASTELSYS_BETA_HPP

#include "pastel/sys/math/beta.h"
#include "pastel/sys/math/gamma.h"

namespace Pastel
{

    template <typename Real>
    Real beta(
        NoDeduction<Real> x,
        NoDeduction<Real> y)
    {
        return (gamma<Real>(x) * gamma<Real>(y)) / 
            gamma<Real>(x + y);
    }

    template <typename Real>
    Real lnBeta(
        NoDeduction<Real> x,
        NoDeduction<Real> y)
    {
        return (lnGamma<Real>(x) + lnGamma<Real>(y)) - 
            lnGamma<Real>(x + y);
    }

}

#endif