home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!psuvax1!hsdndev!cfa203!job
- From: job@head-cfa.harvard.edu (Jeffrey Oliver Breen)
- Newsgroups: sci.math.num-analysis
- Subject: Re: Integration of Step function algorithm/code any?
- Summary: The answer is 1!
- Message-ID: <1992Aug28.011918.22579@harlow.harvard.edu>
- Date: 28 Aug 92 01:19:18 GMT
- References: <1992Aug14.040957.16304@Princeton.EDU>
- Organization: Smithsonian Astrophysical Observatory, Cambridge, MA, USA
- Lines: 33
-
- In article <1992Aug14.040957.16304@Princeton.EDU> muyu@burn.Princeton.EDU (Muyu Guo) writes:
- >I am having trouble doing the integral using either qtrap
- >or qsimp from Numerical Recipes:
- >
- > b
- > /
- > | f(x)dx, with a < 1, b > 2
- > /
- > a
- > and f(x) = 1 (1 <= x <= 2)
- > = 0 otherwise
- >
- >For example a=0, b=4 or the like the results were nonsense.
- >
- >Does anyone know if there is a good way to get thru this?
- >Thanks a million for your attention.
-
- Since f(x) will be one from x=1 to x=2, and this range is included by
- the a<1 and b>2 guarantee, and the function is zero everywhere else,
- then the integral just becomes:
-
- 2
- /
- | 1 dx, otherwise known as 1. Is there a reason you were trying to
- /
- 1
-
- solve this numerically?
- --
- +-----------
- | Jeffrey Oliver Breen Harvard-Smithsonian Center for Astrophysics,
- | (617) 495-7252 60 Garden St., Room B-340, MS 6, Cambridge, MA 02138
- |
-