Polynomial2D example 7
This example shows the usage of [[Polynomial2D_]] class. In this example we get polynomials by adding monomials.
- poly = mono + integer
- poly = mono + real
- poly = integer + mono
- poly = real + mono
- poly = mono + mono
- poly = mono + poly
- poly = poly + mono
- poly = poly + poly
- poly = poly + integer
- poly = poly + real
- poly = integer + poly
- poly = real + poly
Modules and classes
- [[Polynomial2D_]]
Usage
PROGRAM main
use easifemBase
use easifemClasses
implicit none
type(Polynomial2D_) :: f1, f2
type(Monomial2D_) :: m1, m2
!!! note "Monomial + integer" Initiate the [[Monomial2D_]] object.
m1 = Monomial2D( 1,1,"x","y" )
f1 = m1 + 1
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "integer+monomial"
f1 = 1+m1
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "monomial + real"
f1 = m1 + 1.0
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "real + monomial"
f1 = 1.0 + m1
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "monomial+ monomial"
f1 = m1 + m1
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "polynomial + monomial"
m2 = Monomial2D( 2, 0, "x", "y" )
f1 = f1 + m2
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "monomial + polynomial"
m2 = Monomial2D( 0, 2, "x", "y" )
f1 = m2 + f1
call f1%display( 'f(x,y)=' )
!!! example "result"
!!! note "polynomial + polynomial"
f2 = f1 + f1
call f2%display( 'f(x,y)=' )
!!! example "result"
!!! note "polynomial + integer"
f2 = f1 + 1
call f2%display( 'f(x,y)=' )
!!! example "result"
!!! note "integer + polynomial"
f2 = 1 + f1
call f2%display( 'f(x,y)=' )
!!! example "result"
END PROGRAM main