home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / sci / math / numanal / 2582 < prev    next >
Encoding:
Text File  |  1992-08-29  |  2.0 KB  |  62 lines

  1. Newsgroups: sci.math.num-analysis
  2. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!burn.Princeton.EDU!muyu
  3. From: muyu@burn.Princeton.EDU (Muyu Guo)
  4. Subject: Re: Integration of Step function algorithm/code any?
  5. Message-ID: <1992Aug28.150316.21775@Princeton.EDU>
  6. Originator: news@nimaster
  7. Sender: news@Princeton.EDU (USENET News System)
  8. Nntp-Posting-Host: burn.princeton.edu
  9. Organization: Princeton University
  10. References: <1992Aug28.011918.22579@harlow.harvard.edu>
  11. Date: Fri, 28 Aug 1992 15:03:16 GMT
  12. Lines: 48
  13.  
  14. From article <1992Aug28.011918.22579@harlow.harvard.edu>, by job@head-cfa.harvard.edu (Jeffrey Oliver Breen):
  15. > In article <1992Aug14.040957.16304@Princeton.EDU> muyu@burn.Princeton.EDU (Muyu Guo) writes:
  16. >>I am having trouble doing the integral using either qtrap
  17. >>or qsimp from Numerical Recipes:
  18. >>
  19. >>    b
  20. >>    /
  21. >>    | f(x)dx,          with a < 1, b > 2
  22. >>    /
  23. >>    a
  24. >>               and f(x) = 1 (1 <= x <= 2)
  25. >>                 = 0  otherwise
  26. >>
  27. >>For example a=0, b=4 or the like the results were nonsense.
  28. >>
  29. >>Does anyone know if there is a good way to get thru this?
  30. >>Thanks a million for your attention.
  31. > Since f(x) will be one from x=1 to x=2, and this range is included by
  32. > the a<1 and b>2 guarantee, and the function is zero everywhere else,
  33. > then the integral just becomes:
  34. >   2
  35. >  /
  36. >  | 1 dx, otherwise known as 1.  Is there a reason you were trying to
  37. >  /
  38. >  1
  39. > solve this numerically?
  40. > -- 
  41. > +-----------
  42. > | Jeffrey Oliver Breen   Harvard-Smithsonian Center for Astrophysics,
  43. > | (617) 495-7252         60 Garden St., Room B-340, MS 6, Cambridge, MA  02138
  44. > |
  45.  
  46. I think I should rephrase the original question in the 
  47. definition of f(x):   f(x) = 1 ( a < x1 < x < x2 < b)
  48.                = 0 otherwise
  49.  
  50.                I don't know a prior what  is x1 and x2.
  51.  
  52. So I was told better use an adaptive algorithm for this. Actually
  53. I can do it even with simple trap routine provided I don't want 
  54. too much accuracy, say, relative error 1e-5 between successive
  55. approximate values of the integral.
  56.  
  57. -- 
  58. Muyu Guo
  59.