BESSEL_J関数

 投稿者:しばっち  投稿日:2015年 8月 1日(土)21時54分46秒
 
CALL GINIT(800,400)
SET WINDOW 0,30,-.5,.5
DRAW GRID(1,1)
FOR N=0 TO 5
   SET LINE COLOR N+1
   FOR X=0 TO 30 STEP 1/16
      LET Y=BESSELJ(N,X)
      PLOT LINES:X,Y;
   NEXT  X
   PLOT LINES
NEXT N
END

EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB

EXTERNAL  FUNCTION INTEGRAL(R,Z) !'ガウス・ルジャンドル
LET A=0
LET B=PI
LET U=(B+A)/2
LET V=(B-A)/2
FOR I=1 TO 20
   READ X,C
   LET S=S+C*F(R,Z,U+V*X)*V
NEXT I
LET INTEGRAL=S/PI
DATA -.9931285991850949,1.7614007139152118E-02
DATA -.9639719272779138,4.0601429800386941E-02
DATA -.9122344282513259,6.2672048334109064E-02
DATA -.8391169718222188,8.3276741576704749E-02
DATA -.7463319064601508,1.0193011981724044E-01
DATA -.6360536807265150,1.1819453196151842E-01
DATA -.5108670019508271,1.3168863844917663E-01
DATA -.3737060887154196,1.4209610931838205E-01
DATA -.2277858511416451,1.4917298647260375E-01
DATA -.0765265211334973,1.5275338713072585E-01
DATA  .0765265211334973,1.5275338713072585E-01
DATA  .2277858511416451,1.4917298647260375E-01
DATA  .3737060887154196,1.4209610931838205E-01
DATA  .5108670019508271,1.3168863844917663E-01
DATA  .6360536807265150,1.1819453196151842E-01
DATA  .7463319064601508,1.0193011981724044E-01
DATA  .8391169718222188,8.3276741576704749E-02
DATA  .9122344282513259,6.2672048334109064E-02
DATA  .9639719272779138,4.0601429800386941E-02
DATA  .9931285991850949,1.7614007139152118E-02
END FUNCTION

EXTERNAL  FUNCTION F(R,X,T)
LET F=COS(R*T-X*SIN(T))
END FUNCTION

EXTERNAL  FUNCTION INTEGRAL2(R,Z) !'ガウス・ラゲール
FOR I=1 TO 6
   READ X,W
   LET S=S+FF(R,Z,X)*EXP(X)*W
NEXT I
LET INTEGRAL2=S
DATA     .2228466041792606894643548,4.5896467394996359356828488E-01
DATA    1.1889321016726230307431509,4.1700083077212099411337757E-01
DATA    2.9927363260593140776913253,1.1337338207404497573870619E-01
DATA    5.7751435691045105018398304,1.0399197453149074898913303E-02
DATA    9.8374674183825899177155470,2.6101720281493205947924286E-04
DATA   15.9828739806017017825457916,8.9854790642962123882529205E-07
END FUNCTION

EXTERNAL  FUNCTION FF(R,X,T)
LET FF=EXP(-X*SINH(T)-R*T)
END FUNCTION

EXTERNAL  FUNCTION BESSELJ(R,X) !'Rは実数
LET S=INTEGRAL(ABS(R),X)-SIN(ABS(R)*PI)/PI*INTEGRAL2(ABS(R),X)
IF R<0 THEN LET S=S*(-1)^INT(ABS(R))
LET BESSELJ=S
END FUNCTION
 

戻る