Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  !f(x)=(e^(-x*x)-e^(-x*x/4)+(3x*x/4)(1-5x*x/8))(128/(21x^6))
  2.  !f5 = (exp(-x**2)-exp(-x**2/4)+3/4*x**2*(1-5*x**2/8))(128.0/(21*x**6))
  3. program V5
  4. real*8 :: x, y, y_m, a, b
  5. integer i, n
  6. open(10,file = 'data.dat')   ! открываем
  7. open(30,file="result.dat")
  8. read(10,*) a, b, n
  9. dx = (a+b)/(n + 0.d0)
  10. x = a
  11. do i = 1, n
  12.     y = f5(x)
  13.     y_m = macloren_f5(x)
  14.     x = x + dx
  15.     write(30,*) x, y, y_m, y_m-y
  16.     write(*,*) i
  17. enddo
  18. contains
  19.     function f5(x)
  20.         real*8 :: f5, x
  21.         f5 =(exp(-(x**2)) - exp(-0.d25*(x**2)) + 0.d75*x**2*(1-5.d0/8.d0*x**2))*(128.d0/(21.d0*x**6))
  22.     end function f5
  23.  
  24.     function macloren_f5(x)
  25.         real*8 :: macloren_f5, x
  26.         macloren_f5 = -1.d0+85.d0/336.d0*x**2 - 341.d0/6720.d0*x**4 + 5461.d0/4515840.0*x**8
  27.     end function macloren_f5
  28. end program V5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement