|
DataMuseum.dkPresents historical artifacts from the history of: RegneCentralen GIER Computer |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RegneCentralen GIER Computer Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 4332 (0x10ec) Description: Bits:30000609 ALGOL Dem. Types: 8-hole paper tape Notes: Gier Text, Has10
Demonstration programbegin _____skrvtekst(|< <The present program will demonstrate some of the features of the ALGOL compile the GIER (DISADEC). We start with a simple program which compares the built-in standard function ln with the integral of 1/x, calculated by means of a Simpson algorithm with automatic determination of the proper step size. Here we go:p ln(p) Integral ln(p)-Integral|); >begin integer i; real x, arg, log; _____ _______ ____real procedure Simps(F,x,a,b,delta,V); value a,b,delta,V; real F,x,a,b, ____ _________ _____ ____delta,V;begin integer n,k; real h,J, I; _____ _______ ____V := (b-a)⨯V; n := 1; h := (b-a)/2; x := a; J := F; x := b; J := (J+F)⨯h;J1: b := 0; for k := 1 step 1 until n do ___ ____ _____ __begin x := (2⨯k - 1)⨯h + a; b := b + F end; _____ ___I := 4 ⨯ h ⨯ b + J;if abs(V) ⨯ delta < abs(I - V) then __ ____begin V := I; J := (I+J)/4; n := 2⨯n; h := h/2; go_to J1 end; _____ __ __ ___Simps := I/3end Simps; ___for i := 80 step 4 until 200 do ___ ____ _____ __begin arg := i/100; _____skrvvr; skrv(|d.dd|, arg); < >log := Simps(1/x, x, 1, arg,10 -7, 1000);skrv(|-ddd.ddddddddd|, ln(arg), log, ln(arg) - log) < >end ___end; ___skrvtekst(|< <Next we want to demonstrate the automatic administration of the transfer of program drum tracks which takes place at run time. We run in a small loop containing a block with an array running from 1 to i. We gradually increase i from 500 and upwards in steps of 10. In addition we do a calculation which will call for references to several different drum tracks inside the loop. As the array grows the time used for the calculation increases markedly owing to the more frequent drum transfers forced by the decreased space available for program.|); >begin integer i, j; _____ _______for i := 500 step 10 until 700 do ___ ____ _____ __begin trykvr; tryk(|dddd|, i); _____ < >begin array a[1:i]; _____ _____for j := 1 step 1 until i do a[j] := j + sin(j) - exp(-j) ___ ____ _____ __end ___end ___end; ___skrvtekst(|< <The next program makes use of a recursive procedure for summing, SIGMA. SIGMA calculates a sum of terms as the first term plus the sum of the rest. This means that to calculate the sum of i terms theprocedure is called recursively to the i-th level.|); >begin integer k, i; _____ _______real procedure SIGMA(p, q, r, f); value q, r; integer p, q, r; ____ _________ _____ _______real f; ____begin p := q; _____SIGMA := if q>r then 0 else f + SIGMA(p, q+1, r, f) __ ____ ____end; ___for k := 50 step 1 until 65 do ___ ____ _____ __begin skrvvr; _____skrv(|ddd|, k); < >skrv(|ddddddd|, SIGMA(i, 1, k, 2⨯i)) < >end ___end; ___skrvtekst(|< <The final demonstration is an example of how it is possible in Algol (like in any other language) to express simple things in a com- plicated way. We use here the ridiculously complicated process devised by Knuth and Merner (Comm.ACM June 1961) for the calculation of the first 20 primes. i Prime number i|); >begin integer m, P, I, A, Z; _____ _______real procedure GPS(II,N,ZZ,V); real II,N,ZZ,V; ____ _________ ____begin for II:= 1 step 1 until N do ZZ := V; _____ ___ ____ _____ __GPS := 1end; ___for m := 1 step 1 until 20 do ___ ____ _____ __begin I := GPS(I,if I=0 then -1.0 else I,P,if I=1 then 1.0 else _____ __ ____ ____ __ ____ ____if GPS(A,I,Z,if A=1 then 1 else __ __ ____ ____if entier(A) ⨯ (entier(I)_entier(A))=entier(I)∧A<I __ :then 0 else Z) = Z then ____ ____ ____(if P<m then P+1 else I ⨯ GPS(A,1,I,-1)) else P); __ ____ ____ ____skrvvr;skrv(|ddddd|, m, P) < >end ___end; ___end of the demonstration program; ___