🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #366

Re: Integration of Step function algorithm/code any?

#366
From: Jeffrey Oliver Breen
Date: Fri, 28 Aug 1992 01:19
33 lines
1413 bytes
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
|
Technical Details
Message-ID: <1992Aug28.011918.22579@harlow.harvard.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!psuvax1!hsdndev!cfa203!job
References: <1992Aug14.040957.16304@Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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