Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Program test1
  2.  implicit none
  3.  
  4.  real::  maximum, step
  5.  integer:: i, n
  6.  real :: Q, f
  7.  real, external :: hamso
  8.  
  9.  Print *,"gia tri toi da cua truc x ?"
  10.  read *,maximum
  11.  Print *, "buoc nhay? "
  12.  read *,step
  13.  
  14.  n = (maximum/step) -1
  15.  
  16.  Do i=1, n
  17.   If (Q == 1.0) then
  18.   goto 10
  19.    end if
  20.   f = hamso(Q)
  21.  Open (1, file = 'point.doc')
  22.  write (1) Q, f
  23.   Print *, "ngang = ",Q, "Tung = ", f
  24. 10 Q = Q + step
  25.  enddo
  26.  
  27. read *, maximum
  28.  
  29. End program test1
  30.  
  31. Function hamso(Q)
  32.  implicit none
  33.  real, intent(in):: Q
  34.  real:: hamso
  35.  
  36.  hamso = (1.0/2.0) * sqrt((1.0-2.0*Q+ Q*Q)/(1.0-2.0*Q+2.0*Q * 0.8+Q*Q))   +1.0/2.0
  37.  
  38. end function hamso
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement