public static double pt(double t,double df) {
	    // ALGORITHM AS 3  APPL. STATIST. (1968) VOL.17, P.189
	    // Computes P(T<t)
	    double a,b,idf,im2,ioe,s,c,ks,fk,k;
	    double g1=0.3183098862;// =1/pi;
	    if(df<1)
	      throw new IllegalArgumentException("Illegal argument df for pt(t,df).");
	    idf=df;
	    a=t/Math.sqrt(idf);
	    b=idf/(idf+t*t);
	    im2=df-2;
	    ioe=idf%2;
	    s=1;
	    c=1;
	    idf=1;
	    ks=2+ioe;
	    fk=ks;
	    if(im2>=2) {
	      for(k=ks;k<=im2;k+=2) {
	        c=c*b*(fk-1)/fk;
	        s+=c;
	        if(s!=idf) {
	          idf=s;
	          fk+=2;
	        }
	      }
	    }
	    if(ioe!=1)
	      return 0.5+0.5*a*Math.sqrt(b)*s;
	    if(df==1) s=0;
	    return 0.5+(a*b*s+Math.atan(a))*g1;
	  }