DECLARE SUB STVH0 (X#, SH0#) '************************************************************** '* Purpose: This program computes Struve function * '* H0(x) using subroutine STVH0 * '* Input : x --- Argument of H0(x) ( x ò 0 ) * '* Output: SH0 --- H0(x) * '* Example: * '* x H0(x) * '* ---------------------- * '* 0.0 .00000000 * '* 5.0 -.18521682 * '* 10.0 .11874368 * '* 15.0 .24772383 * '* 20.0 .09439370 * '* 25.0 -.10182519 * '* ---------------------------------------------------------- * '* 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 H0(x) " PRINT "--------------------------" CALL STVH0(X, SH0) PRINT " "; X; " "; SH0 END SUB STVH0 (X, SH0) ' ============================================= ' Purpose: Compute Struve function H0(x) ' Input : x --- Argument of H0(x) ( x > 0 ) ' Output() : SH0(---H0(x)) ' ============================================= PI = 3.141592653589793# S = 1! R = 1! IF (X <= 20!) THEN A0 = 2! * X / PI FOR K = 1 TO 60 R = -R * X / (2! * K + 1!) * X / (2! * K + 1!) S = S + R IF (ABS(R) < ABS(S) * 1E-12) THEN GOTO 15 NEXT K 15 : SH0 = A0 * S ELSE KM = INT(.5 * (X + 1!)) IF (X >= 50!) THEN KM = 25 FOR K = 1 TO KM R = -R * SQR((2! * K - 1!) / X) S = S + R IF (ABS(R) < ABS(S) * 1E-12) THEN GOTO 25 NEXT K 25 : T = 4! / X T2 = T * T P0 = ((((-.0000037043# * T2 + .0000173565#) * T2 - .0000487613#) * T2 + .00017343#) * T2 - .001753062#) * T2 + .3989422793# Q0 = T * (((((.0000032312# * T2 - .0000142078#) * T2 + .0000342468#) * T2 - .0000869791#) * T2 + .0004564324#) * T2 - .0124669441#) TA0 = X - .25 * PI BY0 = 2! / SQR(X) * (P0 * SIN(TA0) + Q0 * COS(TA0)) SH0 = 2! / (PI * X) * S + BY0 END IF END SUB