program teste
use mpol
type(pol) :: p
real :: x,r,t
real, dimension(:), allocatable :: v
call novo(2,p)
call atr(p,2,2.5)
call atr(p,1,0.5)
call val(p,2.0,r)
print*,"r:",r
print*,"----"
call val(p,1.0,t)
print*,"t:",t
print*,"----"
call coef(p,2,x)
print*,"x:",x
print*,"----"
call conv(p,v)
print*,v
end program teste
mpol:
novo(g,p): subroutine that receives as an entry parameter g , integer, the degree of the polynomial that will be created and returns in p, type pol, the polynomial with the degree g and in which every coefficients are 0.
atr(p,i,x): subroutine that receives as an (inout) parameter p, type pol, a polynomial and as an (in) parameter, i and x, type integer and real (respectively), and changes the coefficient of the term of order i from the polynomial p to x.
coef(p,i,x): subroutine that receives as an (inout) parameter p, type pol, a polynomial and as an (in) parameter i type integer (a value) and returns in x, an (out) parameter type real, the coefficient of the term i.
val(p,x,r): subroutine the receives as an (inout) parameter p, type pol, a polynomial and as an (in) parameter x type real (a value), and returns in r (an (out )parameter) type real, the value of the polynomial in x (if this value is bigger than 1, the subroutine should return 1, if the value is smaller than 0, it should return 0).
conv(p,v): subroutine that receives as an (inout) parameter p, type pol, a polynomial, and returns on the (out) parameter v a vector of real numbers, with length gm+1, containing on the position i+1 the coefficient of the term of order i.