drift_kepu_stumpff.f 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. c*************************************************************************
  2. c DRIFT_KEPU_STUMPFF.F
  3. c*************************************************************************
  4. c subroutine for the calculation of stumpff functions
  5. c see Danby p.172 equations 6.9.15
  6. c
  7. c Input:
  8. c x ==> argument
  9. c Output:
  10. c c0,c1,c2,c3 ==> c's from p171-172
  11. c (real scalors)
  12. c Author: Hal Levison
  13. c Date: 2/3/93
  14. c Last revision: 2/3/93
  15. subroutine drift_kepu_stumpff(x,c0,c1,c2,c3)
  16. include '../../swift.inc'
  17. c... Inputs:
  18. real*8 x
  19. c... Outputs:
  20. real*8 c0,c1,c2,c3
  21. c... Internals:
  22. integer n,i
  23. real*8 xm
  24. c----
  25. c... Executable code
  26. n = 0
  27. xm = 0.1
  28. do while(abs(x).ge.xm)
  29. n = n + 1
  30. x = x/4.0
  31. enddo
  32. c2 = (1.-x*(1.-x*(1.-x*(1.-x*(1.-x*(1.-x/182.)
  33. & /132.)/90.)/56.)/30.)/12.)/2.
  34. c3 = (1.-x*(1.-x*(1.-x*(1.-x*(1.-x*(1.-x/210.)
  35. & /156.)/110.)/72.)/42.)/20.)/6.
  36. c1 = 1. - x*c3
  37. c0 = 1. - x*c2
  38. if(n.ne.0) then
  39. do i=n,1,-1
  40. c3 = (c2 + c0*c3)/4.
  41. c2 = c1*c1/2.
  42. c1 = c0*c1
  43. c0 = 2.*c0*c0 - 1.
  44. x = x * 4.
  45. enddo
  46. endif
  47. return
  48. end ! drift_kepu_stumpff
  49. c------------------------------------------------------------------