Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- From: Daniel Lichtblau <danl@xxxxxxxxxxx>
- Date: Fri, 06 Jul 2007 12:15:45 -0700
On Jul 6, 10:24 am, David W. Cantrell <DWCantr...@xxxxxxxxxxx> wrote:
Daniel Lichtblau <d...@xxxxxxxxxxx> wrote:
On Jul 6, 12:35 am, Vladimir Bondarenko <v...@xxxxxxxxxxxxxxx> wrote:
Hello again from the VM machine...
Integrate[(1 + z^2)^n/(1 + z^4)^n, {z, 0, Infinity},
Assumptions -> {n \[Element] Integers, n > 0}]
0
Integrate[(1 + z^2)^1/(1 + z^4)^1, {z, 0, Infinity}]
Pi/Sqrt[2]A bug like this can give one an appreciation of the sometimes
unpleasant interactions between various components of a program
attempting symbolic integration. In this case the actual problem
appears in post-processing simplification. We redo without the
integrality assumption, then use that to simplify the result.
InputForm[i1 = Integrate[(1 + z^2)^n/(1 + z^4)^n,
{z,0,Infinity}, Assumptions->n>0]]
Out[10]//InputForm=
If[2*n > 1, (4^(-1 - n)*(4^(1 + n)*Gamma[5/4]*Gamma[1 - n]*Gamma[-1/4
+ n]*
HypergeometricPFQ[{1/4, 1/2 - n/2, -n/2}, {1/2, 5/4 - n}, -1] +
4^n*n*Gamma[3/4]*Gamma[1 - n]*Gamma[-3/4 + n]*
HypergeometricPFQ[{3/4, 1/2 - n/2, 1 - n/2}, {3/2, 7/4 - n}, -1]
-
8*n*Sqrt[Pi]*Gamma[1/2 - 2*n]*Gamma[-1 + 2*n]*
HypergeometricPFQ[{-1/4 + n/2, 1/4 + n/2, n}, {1/4 + n, 3/4 + n},
-1])*
Sin[n*Pi])/Pi, Integrate[((1 + z^2)/(1 + z^4))^n, {z, 0, Infinity},
Assumptions -> Inequality[0, Less, n, LessEqual, 1/2]]]
Plugging in values near positive integers seems to give reasonable
results.
True, because the singularities are removable.
Right. But not handled using Series technology currently in
Mathematica (so far as I am aware).
But this symbolic result will incorrectly become zero upon
assumption that n is integral.
In[11]:= Simplify[i1, Assumptions->{Element[n,Integers],n>0}]
Out[11]= 0
We have taken some steps to improve on this. For one, the
simplification will become Indeterminate (with appropriate messages)
instead of zero.
In a future release Integrate will take the draconian step of removing
Element[xxx,Integers] assumptions because such assumptions, while
sometimes desirable (e.g. for orthogonal polynomial families), tend to
create havoc for Integrate precisely due to overly aggresive
"simplifications".
Does that mean that Integrate will in the future also ignore Element[xxx,
Integers] if it's used in Assuming[Element[xxx,Integers], Integrate[yyy]] ?
Possibly. Recent issues reported on comp.soft-sys.math.mathematica
have convinced me that it is sometimes tricky to handle that
Assuming[xxx,Integrate[yyy]] construct in a way that effectively
mimics Integrate[yyy,Assumptions->xxx]. But the goal is to have the
same behavior.
Here's why I ask:
Note the difference (in version 5.1) between the following.
In[6]:= Integrate[((1 + z^2)/(1 + z^4))^n, {z, 0, Infinity},
Assumptions -> {n > 0, Element[n, Integers]}]
Out[6]= 0
In[7]:= Assuming[n > 0 && Element[n, Integers],
Integrate[((1 + z^2)/(1 + z^4))^n, {z, 0, Infinity}]]
Out[7]= (Gamma[5/4]*Gamma[-(1/4) + n]*HypergeometricPFQ[
{1/4, 1/2 - n/2, -(n/2)}, {1/2, 5/4 - n}, -1])/
Gamma[n] + (1/4)*((n*Gamma[3/4]*Gamma[-(3/4) + n]*
HypergeometricPFQ[{3/4, 1/2 - n/2, 1 - n/2},
{3/2, 7/4 - n}, -1])/Gamma[n] +
(2*Gamma[1/2 - 2*n]*Gamma[-(1/2) + n]*
HypergeometricPFQ[{-(1/4) + n/2, 1/4 + n/2, n},
{1/4 + n, 3/4 + n}, -1])/Gamma[-n])
Of course, Out[6] is simply wrong. But note that Out[7] is well defined at
positive integers, where your Out[10] had removable singularities.
(Unfortunately both Out[7] and Out[10] have removable singularities
elsewhere; it might be difficult to get a closed form which is well defined
for all real n > 1/2.)
David
Right now my development Mathematica kernel handles these the same as
your 5.1, I think. Both ignore the integrality assumption but the
latter gives the (for this purpose nicer) form
If[2*n > 1, (4*Gamma[5/4]*Gamma[-1/4 + n]*HypergeometricPFQ[
{1/4, 1/2 - n/2, -n/2}, {1/2, 5/4 - n}, -1] +
n*Gamma[3/4]*Gamma[-3/4 + n]*HypergeometricPFQ[{3/4, 1/2 - n/2, 1 -
n/2},
{3/2, 7/4 - n}, -1] + (2^(3 - 2*n)*Sqrt[Pi]*Gamma[1/2 - 2*n]*
Gamma[-1 + 2*n]*HypergeometricPFQ[{-1/4 + n/2, 1/4 + n/2, n},
{1/4 + n, 3/4 + n}, -1])/Gamma[-n])/(4*Gamma[n]),
Integrate[((1 + z^2)/(1 + z^4))^n, {z, 0, Infinity},
Assumptions -> Inequality[0, Less, n, LessEqual, 1/2]]]
There may be places where the more global assumptions will still find
their way into what are meant to be encapsulated uses of Simplify or
Refine.
To address what I think is your main question, I do not see hope in
the near term to force a result that behaves well at a specific
discrete set e.g. integers. The result might or might not, depending
(perhaps) on weather conditions in the Kansas City area. That said,
I'll look into why these examples give slightly different results in
order to see if this indicates a bug somewhere in the processing.
Daniel Lichtblau
Wolfram Research
.
- Follow-Ups:
- References:
- Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- From: Daniel Lichtblau
- Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- From: David W . Cantrell
- Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- Prev by Date: Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- Next by Date: Re: An exact simplification challenge - 33 (ln, exp, polylog) - Go and surpass all CASs
- Previous by thread: Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- Next by thread: Re: Bug in Mathematica 6 - Integrate - 30 - (power, invalid value)
- Index(es):
Loading