Program s22aafe
! S22AAF Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: nag_wp, s22aaf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nlmax = 100, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: x
Integer :: ifail, m, mode, n, nl
! .. Local Arrays ..
Real (Kind=nag_wp) :: p(0:nlmax)
! .. Executable Statements ..
Write (nout,*) 'S22AAF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) mode, x, m, nl
Write (nout,*)
ifail = 0
Call s22aaf(mode,x,m,nl,p,ifail)
Write (nout,*) 'MODE X M NL'
Write (nout,*)
Write (nout,99999) mode, x, m, nl
Write (nout,*)
Select Case (mode)
Case (1)
If (m==0) Then
Write (nout,*) 'Unnormalized Legendre function values'
Else
Write (nout,*) 'Unnormalized associated Legendre function values'
End If
Case (2)
If (m==0) Then
Write (nout,*) 'Normalized Legendre function values'
Else
Write (nout,*) 'Normalized associated Legendre function values'
End If
End Select
Write (nout,*) ' n P(n)'
Do n = 0, nl
Write (nout,99998) n, p(n)
End Do
99999 Format (1X,I3,4X,F5.1,2I6)
99998 Format (1X,I2,1X,1P,E12.4)
End Program s22aafe