Skip to main content

Methods

Chebyshev polynomial of first kind is defined. The nth order Chebyshev polynomial is denoted by Tn(x)T_{n}(x). Chebyshev polynomials are orthogonal polynomials.

It is a child of [[AbstractOrthopol1D_]].

Structure

TYPE, EXTENDS( AbstractOrthoPol1D_ ) :: ChebyshevFirst1D_
CONTAINS

ConstructorMethods

Constructor function

We can create an instance of TnT_{n} by calling ChebyshevFirst1D() function. Examples are included in

  • [[ChebyshevFirst1D_test_1]]
  • [[ChebyshevFirst1D_test_2]]

Interface is given below:

MODULE FUNCTION ChebyshevFirst1D( varname, n, isMonic, &
& isOrthonormal ) RESULT( ans )
CHARACTER( LEN = * ), INTENT( IN ) :: varname
!! variable name
INTEGER( I4B ), INTENT( IN ) :: n
!! order of chebyshev polynomial
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: isMonic
!! Default is .FALSE., if true then leading coeff of poly is 1
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: isOrthonormal
!! Default is .FALSE., if true then the polynomials are orthonormal
TYPE( ChebyshevFirst1D_ ) :: ans
!! Chebyshev polynomial of first kind
END FUNCTION ChebyshevFirst1D

ChebyshevFirst1D_Pointer

We can create an instance of new pointer by ChebyshevFirst1D_Pointer() function.

The interface is given below:

FUNCTION ChebyshevFirst1D_Pointer( varname, n, &
& isMonic, isOrthonormal ) RESULT( ans )
CHARACTER( LEN = * ), INTENT( IN ) :: varname
!! variable name
INTEGER( I4B ), INTENT( IN ) :: n
!! order of chebyshev polynomial
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: isMonic
!! Default is .FALSE., if true then leading coeff of poly is 1
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: isOrthonormal
!! Default is .FALSE., if true then the polynomials are orthonormal
CLASS( ChebyshevFirst1D_ ), POINTER :: ans
!! Chebyshev polynomial of first kind
END FUNCTION ChebyshevFirst1D_Pointer

Deallocate

You can deallocate (or destroy) the object by calling Deallocate() subroutine.

CALL obj%Deallocate()

GetMethods

GetStringForUID

Weight

This function evaluate the weight of the Chebyshev polynomial at a given point x.

GetRecurrenceCoeff

GetCoeffScale

Zeros

GaussQuadrature

GaussRadauQuadratur

GaussLobattoQuadrature

Examples

ChebyshevFirst1D_test_1

ChebyshevFirst1D example 1

This example shows the usage of [[ChebyshevFirst1D_]] class.

Modules and classes

  • [[ChebyshevFirst1D_]]

Usage

PROGRAM main
use easifemBase
use easifemClasses
implicit none
type(ChebyshevFirst1D_) :: obj
type(String) :: astr
integer(i4b) :: ii

n=1

  obj = ChebyshevFirst1D(varname="x", n=1)
call Display( "T(n=1) := " )
call obj%Display( "=>" )
>result
J(n=1, alpha=0.0, beta=0.0) :=
=>J_1( x ) = ( x-.000 )* 1.000* J_0
=>J_0( x ) = 1

n=2

  call blanklines( nol=5 )
obj = ChebyshevFirst1D(varname="x", n=2)
call Display( "J(n=2, alpha=0.0, beta=0.0) := " )
call obj%Display( "=>" )
>result
J(n=2, alpha=0.0, beta=0.0) :=
=>J_2( x ) = ( x-.000 )* 1.500* J_1( x ) - .333* 1.500* J_0( x )
=>J_1( x ) = ( x-.000 )* 1.000* J_0
=>J_0( x ) = 1

n=3

  call blanklines( nol=5 )
obj = ChebyshevFirst1D(varname="x", n=3)
call Display( "J(n=3, alpha=0.0, beta=0.0) := " )
call obj%Display( "=>" )
>result
J(n=3, alpha=0.0, beta=0.0) :=
=>J_3( x ) = ( x-.000 )* 1.667* J_2( x ) - .267* 2.500* J_1( x )
=>J_2( x ) = ( x-.000 )* 1.500* J_1( x ) - .333* 1.500* J_0( x )
=>J_1( x ) = ( x-.000 )* 1.000* J_0
=>J_0( x ) = 1

n=4

  call blanklines( nol=5 )
obj = Jacobi1D(varname="x", n=4, alpha=0.0_DFP, beta=0.0_DFP)
call Display( "J(n=4, alpha=0.0, beta=0.0) := " )
call obj%Display( "=>" )
>result
J(n=4, alpha=0.0, beta=0.0) :=
=>J_4( x ) = ( x-.000 )* 1.750* J_3( x ) - .257* 2.917* J_2( x )
=>J_3( x ) = ( x-.000 )* 1.667* J_2( x ) - .267* 2.500* J_1( x )
=>J_2( x ) = ( x-.000 )* 1.500* J_1( x ) - .333* 1.500* J_0( x )
=>J_1( x ) = ( x-.000 )* 1.000* J_0
=>J_0( x ) = 1
END PROGRAM main

ChebyshevFirst1D_test_6

ChebyshevFirst1D example 6

This example shows the usage of [[ChebyshevFirst1D_]] class. We test Zeros function in this routine, which returns the zeros of Chebyshev1 polynomial.

Modules and classes

  • [[ChebyshevFirst1D_]]

Usage

PROGRAM main
use easifemBase
use easifemClasses
implicit none
type(ChebyshevFirst1D_) :: obj
real( dfp ), allocatable :: x( : )
integer( i4b ) :: n

n=1

  n = 1
obj = ChebyshevFirst1D(varname="x", n=n)
x = obj%zeros()
call display( x, "zeros for n="//tostring(n), orient="ROW" )

n=2

  n = 2
obj = ChebyshevFirst1D(varname="x", n=n)
x = obj%zeros()
call display( x, "zeros for n="//tostring(n), orient="ROW" )

n=3

  n = 3
obj = ChebyshevFirst1D(varname="x", n=n)
x = obj%zeros()
call display( x, "zeros for n="//tostring(n), orient="ROW" )

n=4

  n = 4
obj = ChebyshevFirst1D(varname="x", n=n)
x = obj%zeros()
call display( x, "zeros for n="//tostring(n), orient="ROW" )
END PROGRAM main