Advertisement
v15

Integral

v15
Sep 11th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program ex625
  2. !Enrique Ch Gabrick
  3. !Resolver a integral de e^-x nos intervalos [0,1]
  4. IMPLICIT NONE
  5. DOUBLE PRECISION :: y, h, f
  6. !INTEGER i
  7. real x, dx, a, b, m, m0, i, g, x0, x1, x2, x3, y0, y1, y2, y3, d0, d1, d2, d3
  8. real,parameter :: exp = 2.718281828
  9.  
  10. print *, 'Entre com o intervalo b e a'
  11. read *, a,b
  12. print *, 'Entre com o valor de m'
  13. read *,m
  14.  
  15. if(m .eq. 0.00) stop 'valor ilegal de m'
  16.  
  17. open(unit=11,file='ex625.dat')
  18.  
  19. h = (b - a)/2
  20. x0 = 0.25
  21. x1 = 0.50
  22. x2 = 0.75
  23. x3 = 1.00
  24.  
  25. y0 = exp**(-x0)
  26. y1 = exp**(-x1)
  27. y2 = exp**(-x2)
  28. y3 = exp**(-x3)
  29.  
  30. d0 = 1
  31. d1 = 2
  32. d2 = 2
  33. d3 = 1
  34.  
  35.  
  36. g = h/2*(d0*y0 + d1*y1 + d2*y2 + d3*y3)
  37.  
  38. write(11,*)g,y0,y1,y2,y3
  39. close(11)
  40.  
  41. end program ex625
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement