Re: Re: More weird integration issues...

*To*: mathgroup at smc.vnet.net*Subject*: [mg35777] Re: [mg35748] Re: [mg35728] More weird integration issues...*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Tue, 30 Jul 2002 07:22:36 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Bobby Treat has shown convincingly that the formula returned by Mathematica is correct. Moreover, repeating my numerical test I now get the same answer (up to infinitesimals) in both cases which suggests that I was nto careful enough when first performing this test. This seems to have a very weird implications. It appears that we are dealing with a bug of a most unusual kind, whose effects are somehow removed by using subscripts. Although it would appear very unlikely unlikely it does look look as if subscripts were used in at least some of the code of Integrade and it somehow became "subscript dependent". It certainly seems to merit an inversitgation by WRI. Andrzej Kozlowski On Monday, July 29, 2002, at 04:13 PM, Andrzej Kozlowski 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: > > > 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}] > > Now set > > > Evaluate[Table[Subscript[p, i], {i, 1, 5}]] = Table[Random[], {5}] > > and also > > sd = Random[]; m = Random[]; > > Now evaluate again > > > 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}] > > and > > formula > > 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 JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ > > 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: http://www.hex21.com/~binesh/binesh-public.asc >> SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub >> SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub >> OpenSSH Key: http://www.hex21.com/~binesh/binesh-openssh.pub >> >> >> > > >