Advertisement
Oppaceted

Degree_row_module

May 12th, 2024
1,452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Degree_row_module
  2.     contains
  3.     !
  4.     subroutine output(string,x,n,y,d)
  5.         integer :: string,i
  6.         integer :: n(string)
  7.         real(8) :: x(string),y(string),d(string)
  8.         character(len = 72) :: cap = '+----+----------+------+----------+---------------+'
  9.         write (*,'(a)') cap
  10.         write (*,'(a)') '|  i |    x{i}  | n{i} |   y{i}   |      d{i}     |'
  11.         do i = 1,string
  12.             write (*,'(a)') cap
  13.             write (*,'(a, i3, a, f10.6, a, i6, a, f10.6, a, es15.6, a)') '|', i, ' |', x(i), '|', n(i), '|', y(i),'|',d(i),'|'
  14.         end do
  15.         write (*,'(a)') cap
  16.     end subroutine
  17.     !
  18.     subroutine ryad(str, x, n, y, d, E)
  19.         integer :: str
  20.         real(8) :: x(str), y(str), d(str)
  21.         integer :: n(str)
  22.         integer :: i
  23.         real(8) :: E, ui
  24.         do i =1, str
  25.             n(i) = 0
  26.             y(i) = log(2.0d0)
  27.             ui = -1.0d0
  28.             do while ( (abs(ui) >= (E * abs( y(i) ) ) ) .and. (n(i)<2500) )
  29.                 n(i) = n(i) + 1
  30.                 ui = -ui*x(i)*(0.5d0)
  31.                 y(i) = y(i) + ui/n(i)
  32.             end do
  33.             d(i) = abs( y(i)-log(x(i) + 2.0) )
  34.         end do
  35.     end subroutine
  36. end module
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement