|
!'/1
!'|f(x)dx*SQR(1-x^2)
!'/-1
LET N=5000
!'INPUT PROMPT "下限 =":A
INPUT PROMPT "上限 =":B
LET A=1
LET U=(B+A)/2
LET V=(B-A)/2
FOR I=1 TO N
LET X=COS((2*I-1)/2/N*PI)
LET XX=U+V*X
LET S=S+SQR((B-XX)*(XX-A))*FUNC(XX)
LET SS=SS+SQR(1-X*X)*FUNC(XX)*V
NEXT I
PRINT S*PI/N;SS*PI/N
PRINT LOG(B)
END
EXTERNAL FUNCTION FUNC(X)
LET FUNC=1/X
END FUNCTION
------------------------------------------------------------------------------------
!'/1
!'|f(x)dx/SQR(1-x^2)
!'/-1
LET N=5000
INPUT PROMPT "下限 =":A
INPUT PROMPT "上限 =":B
LET U=(B+A)/2
LET V=(B-A)/2
FOR I=1 TO N
LET X=COS(I*PI/(N+1))
LET XX=V*X+U
LET W=PI/(N+1)*SIN(I*PI/(N+1))^2
LET S=S+FUNC(XX)/SQR(1-X*X)*W*V
NEXT I
PRINT S
PRINT B^4/4-A^4/4
END
EXTERNAL FUNCTION FUNC(X)
LET FUNC=X^3
END FUNCTION
|
|