Kody źródłowe/Tablica rozkładu Cauchy'ego

Tablica rozkładu Cauchy'ego • Kod źródłowy
Tablica rozkładu Cauchy'ego
Kod źródłowy

Kod w języku SAS 4GL

data _null_;
	do while (1);
		retain x1 -5000 F2 0.001 x -5000 F 0;
		F1=cdf('CAUCHY',x1);

		minx=x;
		maxx=5100;
		Fs=.;
		do while (1);
			x2=(minx+maxx)/2;
			Fs=cdf('CAUCHY',x2);
			if abs(Fs-F2)<1e-8 or maxx-minx<1e-10
				then leave;
			if Fs>F2 then
				maxx=x2;
			else
				minx=x2;
		end;

		if x1<x2 then do;
			x=x1;
			F=round(F1,0.000001);
			if x<-400 or x>=400-0.00001 then
				x1=x1+100;
			else if x<-50 or x>=50-0.00001 then
				x1=x1+10;
			else if x<-5 or x>=5-0.00001 then
				x1=x1+1;
			else if x<-3 or x>=3-0.00001 then
				x1=x1+0.1;
			else x1=x1+0.01;
		end; else do;
			x=round(x2,0.000001);
			F=F2;
			F2=F2+0.001;
		end;
		if x>5000
			then leave;
		p=round(pdf('CAUCHY',x),0.0000001);
		if (x eq 0 or not (-1e-7<=x<=1e-7)) and 
			(x eq -1 or not (0.25-1e-7<=x<=0.25+1e-7)) and
			(x eq 1 or not (0.75-1e-7<=x<=0.75+1e-7))
		then do;
			put '|-';
			put '| ' x;
			if p<1e-5
				then put '| <10<sup>-5</sup>';
				else put '| ' p;
			put '| ' F;
		end;
	end;
run;


Public Domain
Ten tekst nie podlega pod prawa autorskie. Jest zatem własnością publiczną, ponieważ jego autor udostępnił go na licencji public domain.