Article View: sci.math.num-analysis
Article #377Re: Integration of Step function algorithm/code any?
From: Herman Rubin
Date: Fri, 28 Aug 1992 19:59
Date: Fri, 28 Aug 1992 19:59
44 lines
2141 bytes
2141 bytes
In article <1992Aug28.011918.22579@harlow.harvard.edu> job@head-cfa.harvard.edu (Jeffrey Oliver Breen) writes:
>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?
THIS function can be done that way, but what if things are more complicated?
It is not too difficult to handle discontinuous functions, or functions with
discontinuous derivatives, if one knows where the discontinuities are, and
the programmer breaks up the range. For infinities, the problem is worse,
and for unknown discontinuities, still worse.
Some integrators will attempt to handle this, but most assume that the
function is sufficiently smooth that this problem does not arise.
--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hrubin@pop.stat.purdue.edu (Internet, bitnet)
{purdue,pur-ee}!pop.stat!hrubin(UUCP)
Technical Details
Message-ID:
<BtpM7B.6q1@mentor.cc.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!hal.com!decwrl!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubinReferences:
<1992Aug14.040957.16304@Princeton.EDU> <1992Aug28.011918.22579@harlow.harvard.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!hal.com!decwrl!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: sci.math.num-analysis Subject: Re: Integration of Step function algorithm/code any? Message-ID: <BtpM7B.6q1@mentor.cc.purdue.edu> Date: 28 Aug 92 19:59:31 GMT References: <1992Aug14.040957.16304@Princeton.EDU> <1992Aug28.011918.22579@harlow.harvard.edu> Sender: news@mentor.cc.purdue.edu (USENET News) Organization: Purdue University Statistics Department Lines: 44