c6-4 (779503)
Текст из файла
226Chapter 6.Special Functions1(0.5,5.0)incomplete beta function Ix (a,b)(8.0,10.0)(1.0,3.0).6(0.5,0.5).4.2(5.0,0.5)00.2.4.6.81xFigure 6.4.1. The incomplete beta function Ix (a, b) for five different pairs of (a, b). Notice that the pairs(0.5, 5.0) and (5.0, 0.5) are related by reflection symmetry around the diagonal (cf. equation 6.4.3).6.4 Incomplete Beta Function, Student’sDistribution, F-Distribution, CumulativeBinomial DistributionThe incomplete beta function is defined byZ x1Bx (a, b)≡Ix (a, b) ≡ta−1 (1 − t)b−1 dtB(a, b)B(a, b) 0(a, b > 0)(6.4.1)It has the limiting valuesI0 (a, b) = 0I1 (a, b) = 1(6.4.2)and the symmetry relationIx (a, b) = 1 − I1−x(b, a)(6.4.3)If a and b are both rather greater than one, then Ix (a, b) rises from “near-zero” to“near-unity” quite sharply at about x = a/(a + b).
Figure 6.4.1 plots the functionfor several pairs (a, b).Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.
To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America)..86.4 Incomplete Beta FunctionThe incomplete beta function has a series expansion"#∞Xxa(1 − x)bB(a + 1, n + 1) n+11+x,Ix (a, b) =aB(a, b)B(a + b, n + 1)n=0227(6.4.4)xa (1 − x)b 1 d1 d2···Ix (a, b) =aB(a, b) 1+ 1+ 1+(6.4.5)where(a + m)(a + b + m)x(a + 2m)(a + 2m + 1)m(b − m)x=(a + 2m − 1)(a + 2m)d2m+1 = −d2m(6.4.6)This continued fractionconverges rapidly for x < (a + 1)/(a + b + 2), taking inpthe worst case O( max(a, b)) iterations. But for x > (a + 1)/(a + b + 2) we canjust use the symmetry relation (6.4.3) to obtain an equivalent computation where thecontinued fraction will also converge rapidly.
Hence we have#include <math.h>float betai(float a, float b, float x)Returns the incomplete beta function Ix (a, b).{float betacf(float a, float b, float x);float gammln(float xx);void nrerror(char error_text[]);float bt;if (x < 0.0 || x > 1.0) nrerror("Bad x in routine betai");if (x == 0.0 || x == 1.0) bt=0.0;elseFactors in front of the continued fraction.bt=exp(gammln(a+b)-gammln(a)-gammln(b)+a*log(x)+b*log(1.0-x));if (x < (a+1.0)/(a+b+2.0))Use continued fraction directly.return bt*betacf(a,b,x)/a;elseUse continued fraction after making the symreturn 1.0-bt*betacf(b,a,1.0-x)/b;metry transformation.}which utilizes the continued fraction evaluation routine#include <math.h>#define MAXIT 100#define EPS 3.0e-7#define FPMIN 1.0e-30float betacf(float a, float b, float x)Used by betai: Evaluates continued fraction for incomplete beta function by modified Lentz’smethod (§5.2).{void nrerror(char error_text[]);Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).but this does not prove to be very useful in its numerical evaluation. (Note, however,that the beta functions in the coefficients can be evaluated for each value of n withjust the previous value and a few multiplies, using equations 6.1.9 and 6.1.3.)The continued fraction representation proves to be much more useful,228Chapter 6.Special Functionsint m,m2;float aa,c,d,del,h,qab,qam,qap;}Student’s Distribution Probability FunctionStudent’s distribution, denoted A(t|ν), is useful in several statistical contexts,notably in the test of whether two observed distributions have the same mean.
A(t|ν)is the probability, for ν degrees of freedom, that a certain statistic t (measuring theobserved difference of means) would be smaller than the observed value if themeans were in fact the same. (See Chapter 14 for further details.) Two means aresignificantly different if, e.g., A(t|ν) > 0.99. In other words, 1 − A(t|ν) is thesignificance level at which the hypothesis that the means are equal is disproved.The mathematical definition of the function is1A(t|ν) = 1/2 1 νν B( 2 , 2 )Z t−tx21+ν− ν+12dx(6.4.7)Limiting values areA(0|ν) = 0A(∞|ν) = 1A(t|ν) is related to the incomplete beta function Ix (a, b) byν 1,A(t|ν) = 1 − I νν+t22 2(6.4.8)(6.4.9)Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).qab=a+b;These q’s will be used in factors that occurqap=a+1.0;in the coefficients (6.4.6).qam=a-1.0;c=1.0;First step of Lentz’s method.d=1.0-qab*x/qap;if (fabs(d) < FPMIN) d=FPMIN;d=1.0/d;h=d;for (m=1;m<=MAXIT;m++) {m2=2*m;aa=m*(b-m)*x/((qam+m2)*(a+m2));d=1.0+aa*d;One step (the even one) of the recurrence.if (fabs(d) < FPMIN) d=FPMIN;c=1.0+aa/c;if (fabs(c) < FPMIN) c=FPMIN;d=1.0/d;h *= d*c;aa = -(a+m)*(qab+m)*x/((a+m2)*(qap+m2));d=1.0+aa*d;Next step of the recurrence (the odd one).if (fabs(d) < FPMIN) d=FPMIN;c=1.0+aa/c;if (fabs(c) < FPMIN) c=FPMIN;d=1.0/d;del=d*c;h *= del;if (fabs(del-1.0) < EPS) break;Are we done?}if (m > MAXIT) nrerror("a or b too big, or MAXIT too small in betacf");return h;2296.4 Incomplete Beta FunctionSo, you can use (6.4.9) and the above routine betai to evaluate the function.F-Distribution Probability FunctionQ(0|ν1 , ν2) = 1Q(∞|ν1, ν2) = 0(6.4.10)Its relation to the incomplete beta function Ix (a, b) as evaluated by betai above isQ(F |ν1, ν2 ) = Iν2ν2 +ν1 Fν2 ν1,2 2(6.4.11)Cumulative Binomial Probability DistributionSuppose an event occurs with probability p per trial.
Then the probability P ofits occurring k or more times in n trials is termed a cumulative binomial probability,and is related to the incomplete beta function Ix (a, b) as follows:P ≡n Xnj=kjpj (1 − p)n−j = Ip (k, n − k + 1)(6.4.12)For n larger than a dozen or so, betai is a much better way to evaluate the sum in(6.4.12) than would be the straightforward sum with concurrent computation of thebinomial coefficients.
(For n smaller than a dozen, either method is acceptable.)CITED REFERENCES AND FURTHER READING:Abramowitz, M., and Stegun, I.A. 1964, Handbook of Mathematical Functions, Applied Mathematics Series, Volume 55 (Washington: National Bureau of Standards; reprinted 1968 byDover Publications, New York), Chapters 6 and 26.Pearson, E., and Johnson, N.
1968, Tables of the Incomplete Beta Function (Cambridge: Cambridge University Press).Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.
To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).This function occurs in the statistical test of whether two observed sampleshave the same variance. A certain statistic F , essentially the ratio of the observeddispersion of the first sample to that of the second one, is calculated. (For furtherdetails, see Chapter 14.) The probability that F would be as large as it is if thefirst sample’s underlying distribution actually has smaller variance than the second’sis denoted Q(F |ν1, ν2 ), where ν1 and ν2 are the number of degrees of freedomin the first and second samples, respectively.
In other words, Q(F |ν1, ν2) is thesignificance level at which the hypothesis “1 has smaller variance than 2” can berejected. A small numerical value implies a very significant rejection, in turnimplying high confidence in the hypothesis “1 has variance greater or equal to 2.”Q(F |ν1, ν2 ) has the limiting values230Chapter 6.Special Functions6.5 Bessel Functions of Integer Orderk=0The series converges for all x, but it is not computationally very useful for x 1.For ν not an integer the Bessel function Yν (x) is given byYν (x) =Jν (x) cos(νπ) − J−ν (x)sin(νπ)(6.5.2)The right-hand side goes to the correct limiting value Yn (x) as ν goes to someinteger n, but this is also not computationally useful.For arguments x < ν, both Bessel functions look qualitatively like simplepower laws, with the asymptotic forms for 0 < x ν ν11Jν (x) ∼xν ≥0Γ(ν + 1) 22Y0 (x) ∼ ln(x)(6.5.3)π −νΓ(ν) 1Yν (x) ∼ −xν>0π2For x > ν, both Bessel functions look qualitatively like sine or cosine waves whoseamplitude decays as x−1/2 .
Характеристики
Тип файла PDF
PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.
Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.















