Skip to main content

Monomial1D example 5

This example shows the usage of Monomials1D, EvenMonomials1D and OddMonomials1D methods for [[Monomial1D_]] class.

  • Monomials1D returns the monomials from x0x^0 to xnx^{n}
  • EvenMonomials1D returns the monomials from x0x^0 to x2nx^{2n}
  • OddMonomials1D returns the monomials from x1x^1 to x2n+1x^{2n+1}

Modules and classes

  • [[Monomial1D_]]

Usage

PROGRAM main
use easifemBase
use easifemClasses
implicit none
type(Monomial1D_), allocatable :: y1(:), y2(:), y3(:)
integer(i4b) :: ii, n

!!! note "Monomials" Monomials1D returns the monomials x0x^0 to xnx^{n}.

  y1 = Monomials1D( order=5, varname="x" )
do ii = 1, SIZE( y1 )
call y1(ii)%display( "f(" // tostring( ii ) // ")=" )
end do

!!! example "result"

f(1)=x0f(1)=x^0 f(2)=x1f(2)=x^1 f(3)=x2f(3)=x^2 f(4)=x3f(4)=x^3 f(5)=x4f(5)=x^4 f(6)=x5f(6)=x^5

!!! note "Monomials" EvenMonomials1D returns the monomials x0x^0 to x2nx^{2n}.

  y2 = EvenMonomials1D( order=5, varname="x" )
do ii = 1, SIZE( y2 )
call y2(ii)%display( "f(" // tostring( ii ) // ")=" )
end do

!!! example "result"

f(1)=x0f(1)=x^0 f(2)=x2f(2)=x^2 f(3)=x4f(3)=x^4

!!! note "Monomials" OddMonomials1D returns the monomials x1x^1 to x2n+1x^{2n+1}.

  y3 = OddMonomials1D( order=5, varname="x" )
do ii = 1, SIZE( y3 )
call y3(ii)%display( "f(" // tostring( ii ) // ")=" )
end do

!!! example "result"

f(1)=x1f(1)=x^1 f(2)=x3f(2)=x^3 f(3)=x5f(3)=x^5
END PROGRAM main