Chebyshev1EvalAll
Evaluate Chebyshev1 polynomials from order = 0 to n at single or several points.
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION Chebyshev1EvalAll(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 Chebyshev1 polynomial of order = 0 to n (total n+1)
!! at point x
END FUNCTION Chebyshev1EvalAll
END INTERFACE
program main
use easifembase
implicit none
integer( i4b ) :: n
real( dfp ), allocatable :: ans( : ), x
type(string) :: astr
x = 0.0_DFP
n = 5
ans= Chebyshev1EvalAll( n=n, x=x )
astr = MdEncode( ans )
call display( astr%chars(), "" )
end program main
P0 | P1 | P2 | P3 | P4 | P5 |
---|---|---|---|---|---|
1 | 0 | -1 | -0 | 1 | 0 |
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION Chebyshev1EvalAll(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 Chebyshev1EvalAll
END INTERFACE
program main
use easifembase
implicit none
integer( i4b ) :: n
real( dfp ), allocatable :: ans( :, : ), x( : )
type(string) :: astr
x = [-1.0, -0.5, 0.0, 0.5, 1.0]
n = 5
ans= Chebyshev1EvalAll( n=n, x=x )
astr = MdEncode( ans )
call display( astr%chars(), "" )
end program main
P0 | P1 | P2 | P3 | P4 | P5 |
---|---|---|---|---|---|
1 | -1 | 1 | -1 | 1 | -1 |
1 | -0.5 | -0.5 | 1 | -0.5 | -0.5 |
1 | 0 | -1 | -0 | 1 | 0 |
1 | 0.5 | -0.5 | -1 | -0.5 | 0.5 |
1 | 1 | 1 | 1 | 1 | 1 |