|
LET ST=.1
FOR N=0 TO 5
PRINT "BESSEL_J";STR$(N);"(x) 零点"
FOR X=0 TO 30 STEP ST
IF BESSELJ(N,X)*BESSELJ(N,X+ST)<0 THEN !'2分法
LET A=X
LET B=X+ST
DO
LET C=(A+B)/2
IF BESSELJ(N,A)*BESSELJ(N,C)>0 THEN LET A=C ELSE LET B=C
LOOP UNTIL ABS(A-B)<1E-13
PRINT "零点";C
END IF
NEXT X
PRINT
NEXT N
END
EXTERNAL FUNCTION BESSELJ(N,X)
LET M=(X/2)^INT(ABS(N))
LET SIGN=1
FOR K=0 TO 1000
IF K=0 THEN
IF ABS(N)>0 THEN LET M=M/INT(ABS(N))
ELSE
LET M=M/K/(INT(ABS(N))+K)
END IF
IF K>0 THEN LET M=M*X*X/4
LET SS=SS+SIGN*M
IF ABS(M)<1E-15 THEN EXIT FOR
LET SIGN=-SIGN
NEXT K
IF N<0 THEN LET SS=SS*(-1)^INT(ABS(N))
LET BESSELJ=SS
END FUNCTION
|
|