using System; namespace BrazilTimestampReconstruction { /// /// Returns the incomplete gamma function Q(a, x) = 1 - P(a, x). /// public class Gammq { public Gammq() { } public double gammq(double a, double x) { Gcf cf = new Gcf(); Gser ser = new Gser(); if (x < 0.0 || a <= 0.0) try{throw new Exception();} catch (Exception) { } if (x < (a+1.0)) { ser.gser(a,x); return 1.0-ser.Gamser; } else { cf.gcf(a,x); return cf.Gammcf; } } } } /* private void button1_Click(object sender, System.EventArgs e) { NR.SpecialFunctions.Gammq dd = new NR.SpecialFunctions.Gammq(); textBox1.Text = Convert.ToString(dd.gammq(10.5,2.0)); } // result 0.999980128425815 */