LegendreEvalAll
Evaluate Legendre polynomials from order = 0 to n at single or several points.
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION LegendreEvalAll(n, x) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: n
!! Highest order of polynomial.
!! Polynomials from 0 to n will be computed.
REAL(DFP), INTENT(IN) :: x
!! Point of evaluation, $x \in [-1, 1]$
REAL(DFP) :: ans(n + 1)
!! Evaluate Legendre polynomial of order = 0 to n (total n+1)
!! at point x
END FUNCTION LegendreEvalAll
END INTERFACE
This example shows the usage of LegendreEvalAll
method.
This routine evaluates Legendre polynomial upto order n, for many points
program main
use easifembase
implicit none
integer( i4b ) :: n
real( dfp ), allocatable :: ans( :, : ), x( : )
type(string) :: astr
x = [-1.0, 0.0, 1.0]
n = 3
ans= LegendreEvalAll( n=n, x=x )
astr = MdEncode( ans )
call display( astr%chars(), "" )
end program main
P0 | P1 | P2 | P3 |
---|---|---|---|
1 | -1 | 1 | -1 |
1 | 0 | -0.5 | -0 |
1 | 1 | 1 | 1 |
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION LegendreEvalAll(n, x) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: n
!! Highest order of polynomial.
!! Polynomials from 0 to n will be computed.
REAL(DFP), INTENT(IN) :: x(:)
!! number of points, SIZE(x)=M
REAL(DFP) :: ans(SIZE(x), n + 1)
!! shape (M,N+1)
END FUNCTION LegendreEvalAll
END INTERFACE
This example shows the usage of LegendreEvalAll
method.
This routine evaluates Legendre polynomial upto order n, for many points
program main
use easifembase
implicit none
integer( i4b ) :: n
real( dfp ), allocatable :: ans( : ), x
type(string) :: astr
x = -1.0_DFP
n = 3
ans= LegendreEvalAll( n=n, x=x )
astr = MdEncode( ans )
call display( astr%chars(), "" )
end program main
P0 | P1 | P2 | P3 |
---|---|---|---|
1 | -1 | 1 | -1 |