DECLARE SUB STVL0 (X#, SL0#) DECLARE FUNCTION Sq# (X#) '************************************************************** '* Purpose: This program computes modified Struve * '* function L0(x) using subroutine STVL0 * '* Input : x --- Argument of L0(x) ( x ò 0 ) * '* Output: SL0 --- L0(x) * '* Example: * '* x L0(x) * '* ------------------------ * '* 0.0 .00000000D+00 * '* 5.0 .27105917D+02 * '* 10.0 .28156522D+04 * '* 15.0 .33964933D+06 * '* 20.0 .43558283D+08 * '* 30.0 .78167230D+12 * '* 40.0 .14894775D+17 * '* 50.0 .29325538D+21 * '* ---------------------------------------------------------- * '* REFERENCE: "Fortran Routines for Computation of Special * '* Functions, jin.ece.uiuc.edu/routines/routines * '* .html". * '* * '* Basic Release By J-P Moreau, Paris. * '* (www.jpmoreau.fr) * '************************************************************** DEFDBL A-H, O-Z DEFINT I-N PRINT INPUT " Please enter x: ", X PRINT ; PRINT " x L0(x) " PRINT "------------------------------" CALL STVL0(X, SL0) PRINT " "; X; " "; SL0 END FUNCTION Sq (X) Sq = X * X END FUNCTION SUB STVL0 (X, SL0) ' ================================================ ' Purpose: Compute modified Struve function L0(x) ' Input : x --- Argument of L0(x) ( x ò 0 ) ' Output: SL0 --- L0(x) ' ================================================ PI = 3.141592653589793# S = 1# R = 1# IF X <= 20# THEN A0 = 2# * X / PI FOR K = 1 TO 60 R = R * SQ(X / (2# * K + 1#)) S = S + R IF ABS(R / S) < 1E-12 THEN GOTO 15 NEXT K 15 : SL0 = A0 * S ELSE KM = INT(.5 * (X + 1#)) IF (X >= 50#) THEN KM = 25 FOR K = 1 TO KM R = R * Sq((2# * K - 1#) / X) S = S + R IF (ABS(R / S) < 1E-12) THEN GOTO 25 NEXT K 25 A1 = EXP(X) / SQR(2# * PI * X) R = 1# BI0 = 1# FOR K = 1 TO 16 R = .125 * R * Sq(2# * K - 1#) / (K * X) BI0 = BI0 + R IF (ABS(R / BI0) < 1E-12) THEN GOTO 35 NEXT K 35 BI0 = A1 * BI0 SL0 = -2# / (PI * X) * S + BI0 END IF END SUB