Advertisement
am1x

lab3a

Mar 14th, 2024
1,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Fortran 0.51 KB | Fixit | 0 0
  1. program Lab3
  2. use functions
  3.     implicit none
  4.     integer :: N, i
  5.     real(8) :: a, b, eps, h, err
  6. 10  format(f10.6, a, f10.6, a, f10.6, a, f10.6)
  7.  
  8.     a = -0.7d0
  9.     b = 2.2d0
  10.     err = 0
  11.     h = 0
  12.     N = 1
  13.  
  14.     write(1,*) "eps", ";", "Err", ";", "N", ";", "h"
  15.  
  16.     eps = 0.1d0
  17.     do i = 1, 12
  18.         call inttrap(a, b, eps, err, h, N)
  19.         write(*, 10) dlog10(eps), ";", dlog10(Err), ";", dlog(N + 0d0) / dlog(2d0), ";", dlog10(h)
  20.         eps = eps * 0.1d0
  21.     end do
  22.  
  23.     close(1)
  24.     close(2)
  25. end program Lab3
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement