a suprising result from Integrate (Null appeared in the result!)
- To: mathgroup at smc.vnet.net
- Subject: [mg74466] a suprising result from Integrate (Null appeared in the result!)
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Thu, 22 Mar 2007 01:13:45 -0500 (EST)
Hello to all.
I discover (I think) a serious bug in Integrate.
The results are (at least!) surprisingly so I checked many times
before
I post anything!
Quit
$Version
5.2 for Microsoft Windows (June 20, 2005)
Consider the integral
f = HoldForm[Integrate[(1 - Sin[x])^(y/4), {x, 0, 4}]]
Then
ReleaseHold[f /. y -> 1]
4 + Null*(-4 - (4*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2])) - 4*(1 -
Sin[4])^(1/4)
I believe you noticed immediately the appearance of Null!
Information[Null]
"Null is a symbol used to indicate the absence of an expression or a
result. When it appears as an output expression, no output is
printed."
Attributes[Null] = {Protected}
Note also
DeleteCases[4 + Null*(-4 - (4*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2])) -
4*(1 - Sin[4])^(1/4), Null, Infinity]
N[%]
ReleaseHold[f /. y -> 1 /. Integrate[x___] :> NIntegrate[x,
MaxRecursion -> 12]]
-4*(1 - Sin[4])^(1/4) - (4*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2])
-0.6051176113064889
3.0908946898699625
Note also that Null appears also for other values of y
(ReleaseHold[f /. y -> #1] & ) /@ Range[2, 5]
{-2 + 4*Sqrt[2] + (2*(Cos[2] + Sin[2])*Sqrt[1 - Sin[4]])/(Cos[2] -
Sin[2]),
(2/3)*(-2 + (2*2^(1/4)*Pi^(3/2))/Gamma[3/4]^2 -
2^(3/4)*Hypergeometric2F1[1/2, 3/4, 3/2, -1] +
(Cos[4]*(2^(1/4)*Hypergeometric2F1[1/2, 3/4, 3/2, Cos[2 - Pi/4]^2]
+ 2*(1 - Sin[4])^(1/4)))/Sqrt[1 - Sin[4]]), 3 + Cos[4],
(4*((Cos[2] - Sin[2])*(5 + (-6 + Cos[4])*(1 - Sin[4])^(1/4)) -
6*Null*(Cos[2] - Sin[2] + Sqrt[1 - Sin[4]])))/
(5*(Cos[2] - Sin[2]))}
It appears for y=5 and when it appears the result is wrong
DeleteCases[%, Null, Infinity]
N[%]
{-2 + 4*Sqrt[2] + (2*(Cos[2] + Sin[2])*Sqrt[1 - Sin[4]])/(Cos[2] -
Sin[2]),
(2/3)*(-2 + (2*2^(1/4)*Pi^(3/2))/Gamma[3/4]^2 -
2^(3/4)*Hypergeometric2F1[1/2, 3/4, 3/2, -1] +
(Cos[4]*(2^(1/4)*Hypergeometric2F1[1/2, 3/4, 3/2, Cos[2 - Pi/4]^2]
+ 2*(1 - Sin[4])^(1/4)))/Sqrt[1 - Sin[4]]), 3 + Cos[4],
(4*((Cos[2] - Sin[2])*(5 + (-6 + Cos[4])*(1 - Sin[4])^(1/4)) -
6*(Cos[2] - Sin[2] + Sqrt[1 - Sin[4]])))/(5*(Cos[2] - Sin[2]))}
{2.670553068935302, 2.454058460511143, 2.346356379136388,
-2.128162283559219}
(ReleaseHold[f /. y -> #1 /. Integrate[x___] :> NIntegrate[x,
MaxRecursion -> 12]] & ) /@ Range[2, 5]
{2.6705535326036554, 2.4540619799501173, 2.3463563791363886,
2.3070526406806264}
So Null took the place of something?
BTW, Here are plots of the integrands
(Plot[(1 - Sin[x])^(#1/4), {x, 0, 4}] & ) /@ Range[5]
Even the following setting does not fix the situation
Integrate[(1 - Sin[x])^(1/4), {x, 0, Pi/2, 4}]
4 + Null*(-4 - (4*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2])) - 4*(1 -
Sin[4])^(1/4)
The next is funnier!
Integrate[(1 - Sin[x])^(1/4), {x, 0, 1, Pi/2, 2, 4}]
Simplify[%]
Null*(-4 + (4*Sqrt[1 - Sin[1]])/(Cos[1/2] - Sin[1/2])) +
4*(1 + Null - (1 - Sin[1])^(1/4) - (Null*Sqrt[1 - Sin[1]])/(Cos[1/2]
- Sin[1/2])) + 4*(1 - Sin[1])^(1/4) +
Null*(-4 - (4*Sqrt[1 - Sin[2]])/(Cos[1] - Sin[1])) - 4*(1 -
Sin[2])^(1/4) +
4*((1 - Sin[2])^(1/4) + (Null*Sqrt[1 - Sin[2]])/(Cos[1] - Sin[1]) -
(1 - Sin[4])^(1/4) -
(Null*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2]))
-((4*((Cos[2] - Sin[2])*(-1 + (1 - Sin[4])^(1/4)) + Null*(Cos[2] -
Sin[2] + Sqrt[1 - Sin[4]])))/(Cos[2] - Sin[2]))
What about indefinite integrals?
Integrate[(1 - Sin[x])^(1/4), x]
-4*(1 - Sin[x])^(1/4) - (4*Null*Sqrt[1 - Sin[x]])/(Cos[x/2] - Sin[x/
2])
Integrate[(1 - Sin[x])^(1/5), x]
-5*(1 - Sin[x])^(1/5) - (4*Null*Sqrt[1 - Sin[x]])/(Cos[x/2] - Sin[x/
2])
Trying also the setting
(Integrate[(1 - Sin[x])^(1/4), {x, #1[[1]], #1[[2]]}] & ) /@
Partition[{0, Pi/2, 4}, 2, 1]
{4, Null*(-4 - (4*Sqrt[1 - Sin[4]])/(Cos[2] - Sin[2])) - 4*(1 -
Sin[4])^(1/4)}
Of course you can get for Mathematica the correct answer by working as
follows
Integrate[(1 - Sin[x])^a, {x, 0, 4}, Assumptions -> a > 0]
% /. a -> 1/4
N[%]
2^a*(-2*Hypergeometric2F1[1/2, 1 + a, 3/2, -1] +
(2*Pi^(3/2)*Sec[a*Pi])/(Gamma[1/2 - a]*Gamma[1 + a]) +
Cos[4]*Hypergeometric2F1[1/2, 1/2 - a, 3/2, Cos[2 - Pi/4]^2]*Sqrt[2/
(1 - Sin[4])])
2^(1/4)*((2*Sqrt[2]*Pi^(3/2))/(Gamma[1/4]*Gamma[5/4]) -
2*Hypergeometric2F1[1/2, 5/4, 3/2, -1] +
Cos[4]*Hypergeometric2F1[1/2, 1/4, 3/2, Cos[2 - Pi/4]^2]*Sqrt[2/(1
- Sin[4])])
3.0908948436614616
But I believe the appearance of Null is a matter of headache for the
developers!
Dimitris