|
PUBLIC NUMERIC KETA
INPUT X !' X>1
LET KETA=15
LET XK=10^KETA*X
LET Y=PI/2/AGM(1,4/XK)-KETA*LOG(10)
!'LET Y=PI/2/AGM(1,4/X*10^(-KETA))-PI/2/AGM(1,4*10^(-KETA))
!'LET K=ROUND(LOG(10)*KETA,0)
!'LET XK=EXP(K)*X
!'LET Y=PI/2/AGM(1,4/XK)-K
PRINT Y,LOG(X)
END
EXTERNAL FUNCTION AGM(A,B)
LET N=10^(-KETA/2)
DO WHILE ABS(A-B)>N*ABS(A)
LET Y=A
LET A=(A+B)/2
LET B=SQR(Y*B)
LOOP
LET AGM=(A+B)/2
END FUNCTION
-------------------------------------------------------------
PUBLIC NUMERIC KETA
LET KETA=15
INPUT X
LET N=INT(KETA/LOG10(2))
LET M=0.7
LET H=2^(-N/2)
DO
LET M0=M
LET T0=T(M0)
LET M=M0-H*(T0-X)/(T(M0+H)-T0)
LET M=ABS(M)
LOOP WHILE(ABS(M-M0)>ABS(M)*10^(-KETA+2))
PRINT U(M),LOG(X)
END
EXTERNAL FUNCTION U(M)
LET N=INT(KETA/LOG10(2))
LET A=1
LET B=SQR(1-M)
DO WHILE A-B>2^(-N/2)
LET C=(A+B)/2
LET B=SQR(A*B)
LET A=C
LOOP
LET A=PI/(A+B)
LET S=SQR(M)
DO WHILE 1-S>2^(-N/2)
LET A=A*(1+S)/2
LET S=2*SQR(S)/(1+S)
LOOP
LET U=(A*(1+S)/2)
END FUNCTION
EXTERNAL FUNCTION T(M)
LET N=INT(KETA/LOG10(2))
LET V=1
LET S=SQR(M)
DO WHILE 1-S>2^(-N)
LET W=2*S*V/(1+V^2)
LET W=W/(1+SQR(1-W^2))
LET W=(V+W)/(1-V*W)
LET V=W/(1+SQR(1+W^2))
LET S=2*SQR(S)/(1+S)
LOOP
LET T=(1+V)/(1-V)
END FUNCTION
-------------------------------------------------------------
INPUT X
LET A=1
LET B=4/X
DO WHILE 1+SQR(B)>1
LET B=B/EXP(1)
LET D=D+1
LOOP
DO WHILE ABS(A-B)>1E-15
LET LAST=A
LET A=(A+B)/2
LET B=SQR(LAST*B)
LOOP
PRINT PI/(A+B)-D,LOG(X)
END
-------------------------------------------------------------
INPUT X !' X>1
LET KETA=15
LET Q=1/X
LET SG=-1
LET QN=Q
LET T3=Q
LET T0=Q
LET Q2=Q^2
LET QN2=Q2*Q
LET N=INT(KETA/LOG10(2))
LET C=0
DO WHILE QN*QN2>2^(-N)
LET C=C+1
LET QN=QN*QN2
LET T0=T0+SG*QN
LET T3=T3+QN
LET SG=-SG
LET QN2=QN2*Q2
LOOP
LET T0=1-2*T0
LET T3=1+2*T3
LET B=SQR(1-(T0/T3)^4)
LET A=1
LET C2=0
DO WHILE A-B>2^(-N/2)
LET C2=C2+1
LET T0=(A+B)/2
LET B=SQR(A*B)
LET A=T0
LOOP
LET A=(A+B)/2
LET Y=PI/(A*T3^2)
PRINT Y,LOG(X)
END
-------------------------------------------------------------
INPUT PROMPT "X=":X
LET S=(X-1/X)/2
LET C=(X+1/X)/2
DO WHILE ABS(1-C)>1E-15
LET C=SQR((1+C)/2)
LET S=S/C
LOOP
PRINT S,LOG(X)
LET XX=X
LET P=.5
DO WHILE ABS(X-1)>1E-10
LET X=SQR(X)
LET P=2*P
LOOP
LET S=P*(X-1/X)
PRINT S,LOG(XX)
END
-------------------------------------------------------------
INPUT PROMPT "X=":T
LET XX=T
DO
LET X=XX
LET XX=X+EXP(-X)*T-1
LOOP UNTIL ABS(X-XX)<1E-15
PRINT XX,LOG(T)
END
-------------------------------------------------------------
INPUT X
FOR J=100 TO 1 STEP -1
LET S=J/(2+J/((2*J+1)/(X-1)+S))
NEXT J
PRINT 1/(1/(X-1)+S),LOG(X)
END
-------------------------------------------------------------
OPTION ARITHMETIC COMPLEX
LET I=SQR(-1)
LET Z=.5
PRINT -I*LLOG(I*Z+SQR(1-Z*Z)) !'ASIN(X)
PRINT I*LLOG(Z-I*SQR(1-Z*Z)) !'ACOS(X)
PRINT I/2*(LLOG(1-I*Z)-LLOG(1+I*Z)) !'ATAN(X)
PRINT -I*LLOG(SQR(1-1/Z/Z)+I/Z) !'ACOSEC(X)
PRINT -I*LLOG(I*SQR(1-1/Z/Z)+1/Z) !'ASEC(X)
PRINT I/2*(LLOG(1-I/Z)-LLOG(1+I/Z)) !'ACOTAN(X)
PRINT LLOG(Z+SQR(Z*Z+1)) !'ASINH(X)
PRINT LLOG(Z+SQR(Z+1)*SQR(Z-1)) !'ACOSH(X)
PRINT LLOG((1+Z)/(1-Z))/2 !'ATANH(X)
PRINT LLOG(1/Z+SQR(1/Z/Z+1)) !'ACOSECH(X)
PRINT LLOG(1/Z+SQR(1/Z+1)*SQR(1/Z-1)) !'ASECH(X)
PRINT LLOG((Z+1)/(Z-1))/2 !'ACOTANH(X)
END
EXTERNAL FUNCTION LLOG(X)
OPTION ARITHMETIC COMPLEX
FOR J=100 TO 1 STEP -1
LET S=J/(2+J/((2*J+1)/(X-1)+S))
NEXT J
LET LLOG=1/(1/(X-1)+S)
END FUNCTION
|
|