By B.V. Cordingley, D.J. Chamund
Read or Download Advanced BASIC Scientific Subroutines PDF
Similar languages & tools books
This textbook examines the constraint delight challenge (CSP), that is a basic challenge in AI purposes. It goals to supply a finished advent to the CSP, protecting theoretical, useful and implementation concerns. The booklet discusses formal definitions, CSP fixing algorithms and implementation of a few of the algorithms on PROLOG.
Additional resources for Advanced BASIC Scientific Subroutines
1000 1010 1020 1030 1040 1050 1060 1070 1080 1090 1100 1110 1120 1130 1140 1150 REM REM REM REM REM REM REM REM REM END SAMPLE PROGRAM: PXPONDD EVALUATES THE DENSITY AND PROBABILITY THAT IT IS LESS THAN TIME T1 TO THE FIRST FAILURE IN AN EXPONENTIAL DISTRIBUTION LET L1 = 1/92 LET T1 = 50 DETERMINE DENSITY AT T1 AND AREA UNDER CURVE CALL SUBROUTINE XPONDD GOSUB 2000 PRINT II TIME = "; T1. ". MEAN = ". L1 PRINT II DENSITY = ". DFX PRINT" AREA UNDER CURVE ". FX >RUN TIME = 50. 006312. 31 The Subroutines NATURAL LOGARITHM OF THE COMPLETE GAMMA FUNCTION Subroutine: LlVGAAfAf Description Evaluates the natural logarithm of the complete gamma function rea) for a > O.
OF EXACTLY NUMSUC SUCCESSES LOCAL: ... R, OB The Subroutines 2170 2180 2190 2200 2210 2220 2230 2240 2250 2260 2270 2280 2290 2300 2310 2320 2330 2340 2350 REM REM 21 CHECK INPUT DATA IF PB < 0 OR PB > 1 OR NB < 1 THEN GOTO 2310 IF NUMSUC > NB OR NUMSUC < 0 THEN GOTO 2310 LET QB 1 - PB LET PX = QB~NB LET FX = PX IF NUMSUC = 0 THEN GOTO 2290 FOR R = 1 TO NUMSUC LET PX (NB + 1 - R)*PB*PX/(R*QB) LET FX = FX + PX NEXT R REM RETURN REM PRINT " PB, NB OR NUMSUC INVALID" PRINT" PB = "; PB; ", NB = "; NB; PRINT ", NUMSUC = "; NUMSUC END Sample Program If five dice are thrown, determine (a) the probability that exactly three sixes are thrown and (b) the probability of throwing three or more sixes.
High values of ALPHA have the potential to cause overflow. The program is interrupted if ALPHA is greater than lE7. This limiting value may be adjusted to suit the capacity of the reader's machine. 34 Advanced BASIC Scientific Subroutines RATIO OF THE INCOMPLETE GAMMA FUNCTION Subroutine: GAMMFN Description Evaluates the ratio of the incomplete gamma function G (p, y) to the complete function r(p) for p > 0, y > 0. 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 ...