Blame view

fvn_test/test_inter1d.f90 595 Bytes
27d3b84d6   daniau   git-svn-id: https...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  program inter1d
  use fvn
  implicit none
  integer(kind=4),parameter :: ndata=33
  integer(kind=4) :: i,nout
  real(kind=8) :: f,fdata(ndata),h,pi,q,sin,x,xdata(ndata)
  real(kind=8) ::tv
  intrinsic sin
  f(x)=sin(x)
  xdata(1)=0.
  fdata(1)=f(xdata(1))
  h=1./32.
  do i=2,ndata
  xdata(i)=xdata(i-1)+h
  fdata(i)=f(xdata(i))
  end do
  call init_random_seed()
  call random_number(x)
  q=fvn_quad_interpol(x,ndata,xdata,fdata)
  tv=f(x)
  write(*,'("x y z ",1(f8.5))') x
  write(*,'("Calculated (real) value :",f8.5)') tv
  write(*,'("fvn interpolation : ",f8.5)') q
  write(*,'("Relative fvn error :",e12.5)') abs((q-tv)/tv)
  end program