       Critique of these Stieltjes Integration Functions?

• To: mathgroup at smc.vnet.net
• Subject: [mg4193] Critique of these Stieltjes Integration Functions?
• From: sfpse at u.washington.edu (Russell Brunelle)
• Date: Thu, 13 Jun 1996 23:09:25 -0400
• Organization: University of Washington, Seattle
• Sender: owner-wri-mathgroup at wolfram.com

```I'd appreciate any critque you might have of these functions for computing
Stieltjes integrals, or any pointers to literature where quadrature of
this type of integration might be discussed.

(* Functions for Computing Stieltjes Integrals

(* The following functions will approximate the Stieltjes integral
of the function f with respect to the function g, where both
are functions of t.  The range min..max is the range in which
you wish there to be exactly (10^fact)+1 samplings of f and g.
If g is a CDF in the probability sense, and if the random variable
it represents has a finite range, then min and max could be set
to the infimum and supremum of that range, respectively.
If g is a CDF in the probability sense, and it has an infinite
range, then sampling outside of the min/max range is done at the
discretion of the NSum Mathematica function, using the
Wynn-Epsilon method. *)

(* At this point, a modified "Riemann sums" approach is used.
The reason I am posting this to Usenet is that I would like
to learn if there is some way the normal Mathematica
Integrate and NIntegrate functions can be used to compute
Stieltjes integrals, or if some method more advanced than
the method I am using here, could be employed to get better
and faster results.  The results from these functions are
often very crude, especially when fact is low or either
(0<=t<Infinity) or (-Infinity<t<Infinity) is being
considered.  I can be e-mailed at sfpse at u.washington.edu
if you have any suggestions, or references to the literature
where quadrature of Stieltjes integrals is discussed (I have
so far found no such references).

(* This function is used when one only wishes to consider
min<=t<=max.  For example, if g were the CDF for some
random variable which takes on values in the range
min...max, one could calculate the mean of this random variable
with the command StieltjesIntegral[t, g, {t, min, max}] *)

StieltjesIntegral[f_, g_, {t_, min_:0, max_:1}, fact_:2] :=
With[{di=(max-min)/(10^fact)},
Sum[N[((g /. t->t0)-(g /. t->(t0-di))) (f /. t->t0)],
{t0, min, max, di}]]

(* StieltjesIntegralH will perform integration for 0<=t<Infinity,
and StieltjesIntegralG will perform integration for
-Infinity<t<Infinity.  The method used may fail if there
are discontinuities outside of the min..max range *)

StieltjesIntegralG[f_, g_, {t_, min_:0, max_:1}, fact_:2] :=
With[{n=10^fact, di=(max-min)/(10^fact), tfirst=(min+max)/2},
NSum[((g /. t->((-1)^i (Floor[(i-1)/2]+1) di + tfirst))-
(g /. t->(((-1)^i (Floor[(i-1)/2]+1) di + tfirst)-di)))*
(f /. t->((-1)^i (Floor[(i-1)/2]+1) di + tfirst))
,{i, 0, Infinity}, NSumTerms->(n+1), Method->Fit]]

StieltjesIntegralH[f_, g_, {t_, min_:0, max_:1}, fact_:2] :=
With[{n=10^fact, di=(max-min)/(10^fact)},
NSum[((g /. t->t0)-(g /. t->(t0-di))) (f /. t->t0),
{t0, min, Infinity, di}, NSumTerms->(n+1), Method->Fit]]

-------------------------------------------------------------------
Russell D. Brunelle             |  Lab Ph.:  (206) 685-4343
University of Washington        |  Fax:      (206) 685-3072
Industrial Engineering          |  Home Ph.: (206) 526-5328
Box 352650                      |  E-Mail:   sfpse at u.washington.edu
Seattle, WA 98195-2650          |
-------------------------------------------------------------------

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Kei Ker from Bessel functions
• Next by Date: manipulating expressions
• Previous by thread: Re: How to Solve a Quadratic Programming problem?
• Next by thread: manipulating expressions