Polynomial1D example 5
- This example shows the usage of [[Polynomial1D_]] class.
- In this example, we test addition operators.
Modules and classes
- [[Polynomial1D_]]
Usage
PROGRAM main
use easifemBase
use easifemClasses
implicit none
type(Polynomial1D_) :: f1, f2, f3
real(dfp), allocatable :: coeff( : )
integer(i4b), allocatable :: degree( : )
!!! note "Mono+Mono"
f1=Monomial1D(1,"x") + Monomial1D(2,"x")
call f1%display( 'f(x)=' )
!!! example "result"
!!! note "Mono+Scalar"
f1 = Monomial1D(1,"x") + 1
call f1%display("f(x)=")
!!
f1 = Monomial1D(1,"x") + 1.0
call f1%display("f(x)=")
!!
!!! note "Scalar+Mono"
f1 = 1 + Monomial1D(1,"x")
call f1%display("f(x)=")
!!
f1 = 1.0 + Monomial1D(1,"x")
call f1%display("f(x)=")
!!
!!! note "Poly+Mono"
f2 = f1 + Monomial1D(2,"x")
call f2%display("f(x)=")
!!
!!! note "Mono+Poly"
f2 = Monomial1D(2,"x") + f1
call f2%display("f(x)=")
!!
!!! note "Poly+Poly"
f2 = f2 + f1
call f2%display("f(x)=")
!!
!!! note "Poly+Scalar"
f2 = f1 + 1
call f2%display("f(x)=")
!!
f2 = f1 + 1.0
call f2%display("f(x)=")
!!
!!! note "Scalar+Poly"
f2 = 1 + f1
call f2%display("f(x)=")
!!
f2 = 1.0 + f1
call f2%display("f(x)=")
!!
END PROGRAM main