Blame view

fvn_test/test_integ.f90 893 Bytes
27d3b84d6   daniau   git-svn-id: https...
1
  program integ
2919a9e2d   daniau   git-svn-id: https...
2
   use fvn_integ
27d3b84d6   daniau   git-svn-id: https...
3
   implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
4
5
   real(kind=dp_kind), external :: f1,f2,g,h
   real(kind=dp_kind) :: a,b,epsabs,epsrel,abserr,res
27d3b84d6   daniau   git-svn-id: https...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
   integer :: key,ier
   a=0.
   b=1.
   epsabs=1d-8
   epsrel=1d-8
   key=2
   call fvn_integ_1_gk(f1,a,b,epsabs,epsrel,key,res,abserr,ier)
   write(*,*) "Integration of x*x between 0 and 1 : "
   write(*,*) res
   call fvn_integ_2_gk(f2,a,b,g,h,epsabs,epsrel,key,res,abserr,ier)
   write(*,*) "Integration of x*y between 0 and 1 on both x and y : "
   write(*,*) res
  
  end program
  function f1(x)
8d883e8a1   wdaniau   Integration of ki...
21
  use fvn_common
27d3b84d6   daniau   git-svn-id: https...
22
   implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
23
      real(kind=dp_kind) :: x,f1
27d3b84d6   daniau   git-svn-id: https...
24
25
26
      f1=x*x
  end function
  function f2(x,y)
8d883e8a1   wdaniau   Integration of ki...
27
  use fvn_common
27d3b84d6   daniau   git-svn-id: https...
28
   implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
29
      real(kind=dp_kind) :: x,y,f2
27d3b84d6   daniau   git-svn-id: https...
30
31
32
      f2=x*y
  end function
  function g(x)
8d883e8a1   wdaniau   Integration of ki...
33
  use fvn_common
27d3b84d6   daniau   git-svn-id: https...
34
   implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
35
      real(kind=dp_kind) :: x,g
27d3b84d6   daniau   git-svn-id: https...
36
37
38
      g=0.
  end function
  function h(x)
8d883e8a1   wdaniau   Integration of ki...
39
  use fvn_common
27d3b84d6   daniau   git-svn-id: https...
40
   implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
41
      real(kind=dp_kind) :: x,h
27d3b84d6   daniau   git-svn-id: https...
42
43
      h=1.
  end function