MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Evaluating integrals

  • To: mathgroup at
  • Subject: [mg66224] Re: Evaluating integrals
  • From: Paul Abbott <paul at>
  • Date: Thu, 4 May 2006 05:21:28 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <e39jvr$clu$>
  • Sender: owner-wri-mathgroup at

In article <e39jvr$clu$1 at>, "masha" <mshunko at> 

> I am new to Mathematica and am tryong to figure out how to work
> efficently with integrals and run into the following issue. Let's say I
> want to integrate a simple function like Exp[-r b c], where c is a
> normal random variable. Doing this by hand, I can simply complete the
> square and end up with a simple result: Exp[(r^2 b^2 sc^2 )/ 2].

Computing the ExpectedValue of a function with respect to a specified 
distribution is available in the Statistics` packages.

After loading the package stubs,


you can compute the ExpectedValue as follows:

 ExpectedValue[Function[c, Exp[-r b c]], NormalDistribution[mu, s]]

 Exp[(b^2 r^2 s^2)/2 - (b mu r)]

> However, if I run the following code in Mathematica:
> g[c_] := PDF[NormalDistribution[µc, sc], c]
> pi = Exp[-r b c]
> FullSimplify[Integrate[pi g[c], c, Assumptions -> {c > 0, r > 0, b >
> 0}]]

Because you need to integrate over {c, -Infinity, Infinity}. 

  g[c_] = PDF[NormalDistribution[mu, s], c]

  Assuming[s > 0, Integrate[Exp[-r b c] g[c], {c, -Infinity, Infinity}]]

You will get exactly the same answer as above.


Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    

  • Prev by Date: Re: Faster Random Walk Simulation ?!?
  • Next by Date: Re: Selecting Many Things Rather Than Selecting One Thing From Many
  • Previous by thread: Re: Evaluating integrals
  • Next by thread: Re: Evaluating integrals