xj2070 发表于 2005-12-2 17:23

hankel 函数源程序(F90)

<P>由于IMSL只给出了belssel的一,二类函数,但对于三四类的hankel函数晤给出,以下给出hankel程序给大家共享,并不复杂<BR><BR>subroutine hankel(order,class,x,res)<BR>    use imsl            <BR>   <BR> !This is a very useful subroutine,for that in IMSL<BR> !the hankel function is not supported direct <BR>      <BR> ! the bessel function in IMsl LIBARY is not very good<BR> !WHEN CLASS=3 WHICH REPRENTS THE FIRSTKIND BESSEL FUNCTION<BR> !when class=4 WHICH REPRENTS THE second KIND BESSEL FUNCTION <BR>      <BR>       implicitNone<BR>    <BR>    Integer order,N       !the order number requried for computation <BR>    Integer class       !the kind number<BR>    <BR>    Real x,CBS1(order+1),CBS2(order+1) !argument x                <BR>       complex res,i </P>
<P>!--------------------------------------------------------------------</P>
<P>    i=(0,1)      ! the false root<BR>    N=order+1         ! in order compute the orderth result</P>
<P>    Call BSJNS(x,N,CBS1)<BR>    Call BSYS(0.0,x,N,CBS2)</P>
<P>!--------------------------------------------------------------------</P>
<P>       If(class==1)Then</P>
<P>   res=CBS1(N)+i*(CBS2(N))   !the first kind hankel function<BR>       <BR>   Else if(class==2) then<BR>         <BR>   res=CBS1(N)-i*(CBS2(N))   !the second kind hankel function<BR>    <BR>   Else if(class==3) then      !the REPRENTS THE FIRSTKIND BESSEL FUNCTION<BR>      <BR>   res=CBS1(N)+i*0.0</P>
<P>   Else if(class==4) then      ! the REPRENTS THE Second KIND BESSEL FUNCTION<BR>      <BR>   res=CBS2(N)+i*0.0<BR>   <BR>Else<BR>            <BR>   write(*,*) 'the order num is illegal'<BR><BR>   stop <BR>   <BR>    End if<BR> <BR> End subroutine</P>

johhan 发表于 2006-4-12 09:46

回复:(xj2070)hankel 函数源程序(F90)

<DIV class=quote><B>以下是引用<I>xj2070</I>在2005-12-2 17:23:15的发言:</B><BR>
<P>由于IMSL只给出了belssel的一,二类函数,但对于三四类的hankel函数晤给出,以下给出hankel程序给大家共享,并不复杂<BR><BR>subroutine hankel(order,class,x,res)<BR>    use imsl            <BR>   <BR>!This is a very useful subroutine,for that in IMSL<BR>!the hankel function is not supported direct <BR>      <BR>! the bessel function in IMsl LIBARY is not very good<BR>!WHEN CLASS=3 WHICH REPRENTS THE FIRSTKIND BESSEL FUNCTION<BR>!when class=4 WHICH REPRENTS THE second KIND BESSEL FUNCTION <BR>      <BR>       implicitNone<BR>    <BR>    Integer order,N       !the order number requried for computation <BR>    Integer class       !the kind number<BR>    <BR>    Real x,CBS1(order+1),CBS2(order+1) !argument x                <BR>       complex res,i </P>
<P>!--------------------------------------------------------------------</P>
<P>    i=(0,1)      ! the false root<BR>    N=order+1         ! in order compute the orderth result</P>
<P>    Call BSJNS(x,N,CBS1)<BR>    Call BSYS(0.0,x,N,CBS2)</P>
<P>!--------------------------------------------------------------------</P>
<P>       If(class==1)Then</P>
<P>   res=CBS1(N)+i*(CBS2(N))   !the first kind hankel function<BR>       <BR>   Else if(class==2) then<BR>         <BR>   res=CBS1(N)-i*(CBS2(N))   !the second kind hankel function<BR>    <BR>   Else if(class==3) then      !the REPRENTS THE FIRSTKIND BESSEL FUNCTION<BR>      <BR>   res=CBS1(N)+i*0.0</P>
<P>   Else if(class==4) then      ! the REPRENTS THE Second KIND BESSEL FUNCTION<BR>      <BR>   res=CBS2(N)+i*0.0<BR>   <BR>Else<BR>            <BR>   write(*,*) 'the order num is illegal'<BR><BR>   stop <BR>   <BR>    End if<BR><BR>End subroutine</P></DIV>
<P>请教楼主,IMSL其中的函数如何调用 呢?比如讲FFT,谢谢!!!</P>

xj2070 发表于 2006-4-12 12:18

re:

use IMSL <BR>...<BR><BR>FFTRF/DFFTRF (Single/Double precision)<BR>Compute the Fourier coefficients of a real periodic sequence.<BR>Usage<BR><BR>CALL FFTRF (N, SEQ, COEF)<BR><BR>Arguments<BR>N — Length of the sequence to be transformed. (Input)<BR>SEQ — Array of length N containing the periodic sequence. (Input)<BR>COEF — Array of length N containing the Fourier coefficients. (Output)<BR>Comments<BR>1. Automatic workspace usage is<BR>FFTRF 2N + 15 units, or<BR>DFFTRF 4N + 30 units.<BR>Workspace may be explicitly provided, if desired, by use of<BR>F2TRF/DF2TRF. The reference is<BR>CALL F2TRF (N, SEQ, COEF, WFFTR)<BR>The additional argument is<BR>WFFTR — Array of length 2N + 15 initialized by FFTRI (page 770).<BR>(Input)<BR>The initialization depends on N.<BR>2. The routine FFTRF is most efficient when N is the product of small<BR>primes.<BR>3. The arrays COEF and SEQ may be the same.<BR>4. If FFTRF/FFTRB is used repeatedly with the same value of N, then call<BR>FFTRI followed by repeated calls to F2TRF/F2TRB. This is more<BR>efficient than repeated calls to FFTRF/FFTRB.
页: [1]
查看完整版本: hankel 函数源程序(F90)