<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Gallio.Common.Mathematics
{
    /// <summary>
    /// 
    /// </summary>
    public static class Gamma
    {
        private const int MaxIterations = 100; // Maximum allowed number of iterations.
        private const double Accuracy = 3E-7; // Relative accuracy
        private const double Epsilon = 1E-30;

        /// <summary>
        /// Returns the incomplete Gamma function Q(a,x).
        /// </summary>
        /// <param name="a"></param>
        /// <param name="x"></param>
        /// <returns></returns>
        public static double IncompleteGamma(double a, double x)
        {
            if (x < 0)
                throw new ArgumentOutOfRangeException("x");
            if (a <= 0)
                throw new ArgumentOutOfRangeException("a");

            if (x < a + 1)
            {
                // Use the series representation and take its complement.
                return 1 - IncompleteGammaSeries(a, x);
            }

            // Use the continued fraction representation.
            return IncompleteGammaContinuedFraction(a, x);<commit_msg>Added a missing XML doc entry.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Gallio.Common.Mathematics
{
    /// <summary>
    /// Helper methods to calculate the Gamma function (http://en.wikipedia.org/wiki/Gamma_function).
    /// </summary>
    public static class Gamma
    {
        private const int MaxIterations = 100; // Maximum allowed number of iterations.
        private const double Accuracy = 3E-7; // Relative accuracy
        private const double Epsilon = 1E-30;

        /// <summary>
        /// Returns the incomplete Gamma function Q(a,x).
        /// </summary>
        /// <param name="a"></param>
        /// <param name="x"></param>
        /// <returns></returns>
        public static double IncompleteGamma(double a, double x)
        {
            if (x < 0)
                throw new ArgumentOutOfRangeException("x");
            if (a <= 0)
                throw new ArgumentOutOfRangeException("a");

            if (x < a + 1)
            {
                // Use the series representation and take its complement.
                return 1 - IncompleteGammaSeries(a, x);
            }

            // Use the continued fraction representation.
            return IncompleteGammaContinuedFraction(a, x);
{'fraction_non_alphanumeric': 0.11124694376528117, 'fraction_numerical': 0.009779951100244499, 'mean_word_length': 1.7866061293984108, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6262448', 'n_tokens_mistral': 659, 'n_tokens_neox': 608, 'n_words': 196}