       Re: a suprising result from Integrate (Null appeared in the result!)

• To: mathgroup at smc.vnet.net
• Subject: [mg74518] Re: a suprising result from Integrate (Null appeared in the result!)
• From: dh <dh at metrohm.ch>
• Date: Fri, 23 Mar 2007 19:18:07 -0500 (EST)
• Organization: hispeed.ch
• References: <ett79b\$hhh\$1@smc.vnet.net>

```
Hallo Dimitri,

Wolfram seems to have a problem here and should take note.

The code for indefinite integrals seems to have a programming bug as the

following shows:

Integrate[(1 - Sin[x])^(1/4),x]  gives:

-4*(1 - Sin[x])^(1/4) - (4*Null*Sqrt[1 - Sin[x]])/

(Cos[x/2] - Sin[x/2])

Note that the term with Null is actually a constant, therefore, it would

not harm if the Null were not there. But the rest is not an antiderivative.

Daniel

dimitris wrote:

> 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])/(Cos - Sin)) - 4*(1 -

> Sin)^(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])/(Cos - Sin)) -

> 4*(1 - Sin)^(1/4), Null, Infinity]

> N[%]

> ReleaseHold[f /. y -> 1 /. Integrate[x___] :> NIntegrate[x,

> MaxRecursion -> 12]]

>

> -4*(1 - Sin)^(1/4) - (4*Sqrt[1 - Sin])/(Cos - Sin)

> -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*(Cos + Sin)*Sqrt[1 - Sin])/(Cos -

> Sin),

>   (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*(2^(1/4)*Hypergeometric2F1[1/2, 3/4, 3/2, Cos[2 - Pi/4]^2]

> + 2*(1 - Sin)^(1/4)))/Sqrt[1 - Sin]), 3 + Cos,

>   (4*((Cos - Sin)*(5 + (-6 + Cos)*(1 - Sin)^(1/4)) -

> 6*Null*(Cos - Sin + Sqrt[1 - Sin])))/

>    (5*(Cos - Sin))}

>

> It appears for y=5 and when it appears the result is wrong

>

> DeleteCases[%, Null, Infinity]

> N[%]

>

> {-2 + 4*Sqrt + (2*(Cos + Sin)*Sqrt[1 - Sin])/(Cos -

> Sin),

>   (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*(2^(1/4)*Hypergeometric2F1[1/2, 3/4, 3/2, Cos[2 - Pi/4]^2]

> + 2*(1 - Sin)^(1/4)))/Sqrt[1 - Sin]), 3 + Cos,

>   (4*((Cos - Sin)*(5 + (-6 + Cos)*(1 - Sin)^(1/4)) -

> 6*(Cos - Sin + Sqrt[1 - Sin])))/(5*(Cos - Sin))}

> {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

>

> 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])/(Cos - Sin)) - 4*(1 -

> Sin)^(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])/(Cos[1/2] - Sin[1/2])) +

>   4*(1 + Null - (1 - Sin)^(1/4) - (Null*Sqrt[1 - Sin])/(Cos[1/2]

> - Sin[1/2])) + 4*(1 - Sin)^(1/4) +

>   Null*(-4 - (4*Sqrt[1 - Sin])/(Cos - Sin)) - 4*(1 -

> Sin)^(1/4) +

>   4*((1 - Sin)^(1/4) + (Null*Sqrt[1 - Sin])/(Cos - Sin) -

> (1 - Sin)^(1/4) -

>     (Null*Sqrt[1 - Sin])/(Cos - Sin))

> -((4*((Cos - Sin)*(-1 + (1 - Sin)^(1/4)) + Null*(Cos -

> Sin + Sqrt[1 - Sin])))/(Cos - Sin))

>

>

> 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[]}] & ) /@

> Partition[{0, Pi/2, 4}, 2, 1]

> {4, Null*(-4 - (4*Sqrt[1 - Sin])/(Cos - Sin)) - 4*(1 -

> Sin)^(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*Hypergeometric2F1[1/2, 1/2 - a, 3/2, Cos[2 - Pi/4]^2]*Sqrt[2/

> (1 - Sin)])

> 2^(1/4)*((2*Sqrt*Pi^(3/2))/(Gamma[1/4]*Gamma[5/4]) -

> 2*Hypergeometric2F1[1/2, 5/4, 3/2, -1] +

>    Cos*Hypergeometric2F1[1/2, 1/4, 3/2, Cos[2 - Pi/4]^2]*Sqrt[2/(1

> - Sin)])

> 3.0908948436614616

>

> But I believe the appearance of Null is a matter of headache for the

> developers!

>

> Dimitris

>

>

```

• Prev by Date: Re: Integrate (discontinuous antiderivatives by Mathematica)
• Next by Date: Re: Integrate (a difficult integral)
• Previous by thread: a suprising result from Integrate (Null appeared in the result!)
• Next by thread: Re: Definite Integration in Mathematica 2