MathGroup Archive 2002

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

Search the Archive

Re: More weird integration issues...

  • To: mathgroup at
  • Subject: [mg35773] Re: More weird integration issues...
  • From: Binesh Bannerjee <binesh-dated-1028572681.02012b at>
  • Date: Tue, 30 Jul 2002 07:22:29 -0400 (EDT)
  • References: <ai2pua$5l9$>
  • Sender: owner-wri-mathgroup at

Andrzej Kozlowski <andrzej at> wrote:
: There does sem to be a bug here, but it is not quite what you think. 
: It's the first answer that you get that is probably wrong. On the other 
: hand, in the second case it is very unlikely that Mathematica enters an 
: infinite loop, rather it is still trying to arrive at the answer and 
: there is no guarantee that it will reach one after, say a week or a 
: month.

: As for first case, the reason why the answer is probably this. Evaluate 
: the formula:

Thanks for your response! And, sorry about the TMDA hoops! I forgot
to put in a dated address on the post!

Hmmm... I'm not so sure... (I cut and pasted from your post, just so it
will all be directly cut and pastable in Mathematica)

F[a_,b_,c_,d_,e_,f_,X_] := (a + b X + c X^2 + d X^3 + e X^4 + f X^5) *

(* Your formula *)
formula=Integrate[F[Subscript[p, 0], Subscript[p, 1], Subscript[p, 2],
      Subscript[p, 3], Subscript[p, 4], Subscript[p, 5], X]*((X - m)/sd)^5,
    {X, -Infinity, Infinity}]

(* I assume you do {i,1,5} instead of {i,0,5} because the result of
 * the calculation above doesn't include p sub zero *)
Evaluate[Table[Subscript[p, i], {i, 1, 5}]] = Table[Random[], {5}]
sd = Random[]; m = Random[];
Andrzej = Integrate[F[Subscript[p, 0], Subscript[p, 1], Subscript[p, 2],
     Subscript[p, 3], Subscript[p, 4], Subscript[p, 5], X]*((X - m)/sd)^5,
   {X, -Infinity, Infinity}]

This yields for me: 
p = {0.76938, 0.670623, 0.624459, 0.386326, 0.773623}
Andrzej = 26.036 * (2.08162+(1.66533*10^-16)p0)
Chop[Andrzej] = 54.1961
formula = 54.1961

If you just ExpandAll[Andrzej] , you get 54.1961-(4.3358*10^-15)p0

So, I think it's doing the right thing with the p array, it just goes
off into some loop with the a,b,c,d,e,f...

Is that reasoning sound, or am I missing something? Perhaps I'm missing
a point, and they shouldn't be different _at all_... I dunno... Is that
safely negligible as machine precision error?


: You will almost certainly get different answers, while they clearly 
: ought to be the same. It seems that it is nto the fact that the names 
: you are suing are different that leads to different results in both of 
: your integrals but the fact that the names of the parameters in the 
: first case are not symbols. "Officially" there is no reason why they 
: should be, but in practice using non-symbols in formulas makes them more 
: complicated and is more likely to result in errors.

: The really bad news as far as your problem is concerned is that it is 
: the 6 hour fruitless computation that appears to be the correct one ...

: Andrzej Kozlowski
: Toyama International University

: On Saturday, July 27, 2002, at 07:43  PM, Binesh Bannerjee wrote:

:> Hi. I'm trying to compute the 5th moment of a tweak to the normal pdf.
:> Here's what I have:
:> F[a_, b_, c_, d_, e_, f_, X_] := (a + b X + c X^2 + d X^3 + e X^4 + f 
:> X^5)*
:>     Exp[-(((X - m)/sd)^2)/2]/(Sqrt[2Pi]sd)
:> The strange thing, and I'd appreciate someone shedding some light on 
:> this,
:> is that this:
:> \!\(Integrate[
:>     F[p\_0, p\_1, p\_2, p\_3, p\_4, p\_5,
:>         X]*\((\((X - m)\)/sd)\)^5, {X, \(-Infinity\), Infinity},
:>     Assumptions -> {sd > 0}]\)
:> (I cut and pasted that it looks like it works)
:> Anyway, THAT gives me an answer really quickly... (within 5 minutes on 
:> my box)
:> JUST changing it from p0..5 to a,b,c,d,e,f like so:
:> Integrate[F[a, b, c, d, e, f, X]*((X - m)/sd)^5, {X, -Infinity, 
:> Infinity},
:>   Assumptions -> {sd > 0}]
:> Causes mathematica to go into an infinite loop (seemingly after 6 
:> hours).
:> This ... sucks. How am I to know if a certain equation is solvable, if
:> only I choose the right variables??
:> Binesh Bannerjee
:> --
:> "For in much wisdom is much grief, and he that increaseth knowledge
:>  increaseth sorrow." -- Ecclesiastes 1:18
:>     PGP  Key:
:>     SSH2 Key:
:>     SSH1 Key:
:> OpenSSH  Key:

'One of the cultural barriers that separates computer scientists from
 "regular" scientists and engineers is ... the practical scientist is
 trying to solve tomorrow's problem with yesterday's computer; the
 computer scientist, we think, often has it the other way around.'
	-- Numerical Recipes in C

    PGP  Key:
    SSH2 Key:
    SSH1 Key:
OpenSSH  Key:

  • Prev by Date: Re: Re: Work with Contexts
  • Next by Date: Re: RE: RE: Question about Replace
  • Previous by thread: Re: Re: More weird integration issues...
  • Next by thread: More weird integration issues...