By B.V. Cordingley, D.J. Chamund

Best languages & tools books

Threaded Interpretive Languages: Their Design and Implementation

Introduces members possessing microcomputers or minicomputers with minimum peripherals to the layout and implementation of a threaded interpreter as an method of constructing a regular, nonstandard programming language.

Extra info for Advanced BASIC Scientific Subroutines

Example text

Requires subroutine LNGAMM. Method The ratio is defined by G(y,p) = (Ijr(p)) f: tP-1exp(-t)dt p>O,y>O The algorithm used to evaluate G(y,p) has been published by Lau (Griffiths and Hill, I985b) and exploits the relationship G(y,p) = (yPexp(-y))jr(p + 1)) i Cn(y,p) n=O where Co(y,p) = 1 when n =0 Cn(y,p) = (y/(P and + n))Cn - 1 (y,p) for n:::: 1,2 ... DT BETWEEN T = 0 AND T = Y WHERE P > 0 AND Y > O. REQUIRES SUBROUTINE LNGAMM. • FROM SUBROUTINE LNGAMM PARG .... PARAMETER P YARG .... PARAMETER Y OUTPUT: GRAT ....

ARRAY OF DIFFERENT ITEMS OF DATA LOCAL: ... P, Q, R, V1, V2 ARRAY DIMENSIONS: A() ..... (NUMDAT + 1) V() ..... (NUMDAT) F() ..... 01) LET PVAL = (A(V1) + A(V2»/2 CUMULATIVE FREQUENCY LET NITM = 1 FOR P = 1 TO NUMDAT LET F(NITM) = P LET V(NITM) = A(P) IF A(P) <> A(P + 1) THEN LET NITM = NITM + 1 IF P = NUMDAT THEN LET NITM = NITM - 1 NEXT P RETURN REM REM SHELL SORT LET V1 = NUMDAT REM SET GAP LENGTH LET V1 = INT(V1/2) IF V1 = 0 THEN GOTO 2740 FOR P = 1 TO NUMDAT - V1 FOR Q = P TO 1 STEP -1 LET R = Q + V1 REM COMPARE DATA IF A(Q) > A(R) THEN GOTO 2660 LET Q = 0 GOTO 2700 REM EXCHANGE DATA LET V2 = A(Q) LET A(Q) = A(R) LET A(R) = V2 REM NEXT Q NEXT P The Subroutines 55 2730 GOTO 2560 2740 REM 2750 RETURN Sample Program The following list gives the marks obtained in a test by a class of 60 students.

DF2. XF GOSUB 4000 PRINT DF1. DF2. XF. 97E-3 1E-2 1E-3 1E-2 The results agree with those published in tables of the upper percentage points of the F-distribution. The Subroutines 47 UPPER TAIL OF STUDENT'S T DISTRIBUTION Subroutine: TDISTR Description Computes the area under the upper tail of Student's central t distribution for n degrees of freedom. Requires subroutines BETAFN and LNGAMM. /2,n denotes the value of a variable with a t distribution and n degrees of freedom at the point a12. al2 is the probability that the variable exceeds ta/2 ,no Fa, l,n is similarly defined for the F-distribution for 1 and n degrees of freedom.