Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50144/zeroes.bas
There are 2 other files named zeroes.bas in the archive. Click here to see a list.
00100	GO TO 8999
00105	READ I,F,Q,W
00110	PRINT
00115	PRINT "POINT-TYPE","  F(X)","   X"
00120	PRINT
00130	LET K=(F-I)/W
00135	LET K1=K
00140	LET Q5=INT(0.4343*LOG(0.5*(ABS(I)+ABS(F))))
00145	LET M=0.5*(10^(Q5-Q))
00150	LET F1=F+K
00155	LET R=0
00160	LET X=I-K
00165	LET T=2
00200	LET Y=X^3-6*X^2+9*X-2
00700	IF T<2 THEN 3000
00800	IF T=3 THEN 1100
00900	LET T=3
01000	GOTO 5000
01100	IF Y=Y1 THEN 2400
01200	IF Y<Y1 THEN 2000
01300	LET D=1
01400	IF Y1<0 THEN 1700
01500	LET T=-1
01600	GOTO 4100
01700	LET T=1
01800	GOTO 3100
02000	LET D=-1
02100	IF Y1>0 THEN 1700
02200	LET T=0
02300	GOTO 4500
02400	IF K1<M THEN 2800
02500	LET K1=K1/2
02600	LET X=X1+K1
02700	GO TO 5600
02800	PRINT
02801	PRINT "NO CHANGE...."
02900	STOP
03000	IF T<1 THEN 4000
03050	IF Y=0 THEN 6700
03100	IF D=-1 THEN 3500
03200	IF Y>0 THEN 6000
03300	IF ABS(Y)<ABS(Y1) THEN 5000
03400	LET T=-1
03450	GOTO 4100
03500	IF Y<0 THEN 6000
03600	IF ABS(Y)<ABS(Y1) THEN 5000
03700	LET T=0
03800	GOTO 4500
04000	IF R=1 THEN 8500
04050	IF T=0 THEN 4500
04100	IF Y>Y1 THEN 5000
04200	IF K1<M THEN 7000
04300	GOTO 4650
04500	IF Y<Y1 THEN 5000
04600	IF K1<M THEN 8000
04650	LET X1=X1-K1
04660	LET R=1
04700	GOTO 2500
05000	LET Y1=Y
05100	LET X1=X
05500	LET X=X+K1
05600	IF X<F1 THEN 200
05800	STOP
06000	IF K1<M THEN 6200
06100	GOTO 2500
06200	IF ABS(Y)<ABS(Y1) THEN 6700
06300	PRINT "  ZERO"," 0.",X1
06400	LET K1=K
06500	IF D=1 THEN 6600
06520	LET T=0
06560	GOTO 5000
06600	LET T=-1
06660	GOTO 5000
06700	LET Y1=Y
06800	LET X1=X
06900	GOTO 6300
07000	PRINT "     MAX",Y1,X1
07050	LET K1=K
07100	LET D=-1
07200	IF Y1<0 THEN 7500
07300	LET T=1
07400	GOTO 5000
07500	LET T=0
07600	GOTO 5000
08000	PRINT "MIN",Y1,X1
08050	LET K1=K
08100	LET D=1
08200	IF Y1<0 THEN 7300
08300	LET T=-1
08400	GOTO 5000
08500	LET R=0
08600	GOTO 5000
08999	PRINT
09000	PRINT "THIS PROGRAM WILL LOCATE 'INTERESTING' VALUES"
09010	PRINT "OF X FOR ANY FUNCTION OF X.  SPECIFICALLY, IT"
09020	PRINT "WILL LOCATE THE VALUES OF X AT WHICH RELATIVE"
09030	PRINT "MAXIMUMS AND MINIMUMS OF F(X) OCCUR, AND THE"
09040	PRINT "VALUES OF X FOR WHICH F(X) IS ZERO (I.E., THE"
09050	PRINT "ZEROES OR ROOTS OF THE FUNCTION).  TO USE THE"
09060	PRINT "PROGRAM, TYPE THE FOLLOWING:"
09070	PRINT
09080	PRINT "      100  DATA <XMIN>,<XMAX>,<ACC>,<INCR>"
09090	PRINT "      200  LET Y = <A FUNCTION OF X>"
09100	PRINT "      RUN"
09110	PRINT
09120	PRINT "WHERE 'XMIN' AND 'XMAX' DEFINE THE INTERVAL IN"
09130	PRINT "WHICH INTERESTING VALUES OF X ARE TO BE SOUGHT,"
09140	PRINT "'ACC' IS THE ACCURACY (IN NUMBER OF SIGNIFICANT"
09150	PRINT "FIGURES) TO WHICH THE ZEROES OF X AND THE MAX"
09160	PRINT "AND MIN VALUES OF F(X) ARE TO BE ESTIMATED,"
09170	PRINT "'INCR' IS THE NUMBER OF INCREMENTS INTO WHICH"
09180	PRINT "THE TOTAL INTERVAL IS TO BE DIVIDED FOR SEARCH"
09190	PRINT "PURPOSES (TRY 50 TO START), AND THE FUNCTION"
09200	PRINT "OF X IS ANY LEGITIMATE BASIC-LANGUAGE EXPRESS-"
09210	PRINT "ION INVOLVING THE VARIABLE X."
09990	DATA 0,4,8,48
09999	END