# sum of integrals over patial intervals != integral over whole interval

Discussion in 'Mathematica' started by Peter Pein, Nov 27, 2006.

1. ### Peter PeinGuest

Dear group,

I wanted Mathematica to show, that for f[x_]:=Log[Sin[x]^2]Tan[x],
Integrate[f[x],{x,0,Pi}]==0, because f[x]+f[Pi-x]==0.

Mathematica says Integrate[f[x],{x,0,Pi}] does not converge, but
Integrate[f[x],{x,0,Pi/2}] and Integrate[f[x],{x,Pi/2,Pi}] evaluate to
-Pi^2/12 resp. P^2/12 and the sum is zero. The more general integral
Integrate[f[x],{x,0,z},Assumptions->Pi/2<z<=Pi] evaluates explicitly (?).

What did I do wrong?
http://people.freenet.de/Peter_Berlin/Mathe/komisch.nb

TIA,
Peter

Peter Pein, Nov 27, 2006

2. ### dimitrisGuest

$VersionNumber 5.2 Of course your integral is zero. f[x_] := Log[Sin[x]^2]*Tan[x] Plot[f[x], {x, 0, Pi}] Plus @@ (NIntegrate[f[x], {x, #[], #[]}, WorkingPrecision -> 40, PrecisionGoal -> 30] & /@ Partition[Range[0, Pi, Pi/2], 2, 1]) 029.90647836759534 Integrate[f[x], {x, 0, Pi}] Integrate::idiv: Integral of   does not converge on {x,0,p}. Integrate[Log[Sin[x]^2]*Tan[x], {x, 0, Pi}] Some ways to work are: Timing[Integrate[f[x], {x, 0, Pi/2, Pi}]] {11.422*Second, 0} This setting of Integrate seems undocumentated; but it is well documentated for NIntegrate. (see also the following link within MathGroup http://groups.google.com/group/comp...+third+argument&rnum=3&hl=en#623c24b8307057ce ) Or Plus @@ (Integrate[f[x], {x, #1[], #1[]}] & ) /@ Partition[Range[0, Pi, Pi/2], 2, 1] 0 Or F[x_] = Integrate[f[x], x] Log[Sec[x/2]^2]^2 + 2*Log[Sec[x/2]^2]*Log[(1/2)*Cos[x]*Sec[x/2]^2] + Log[Sec[x/2]^2]*Log[Sin[x]^2] - 2*Log[Sec[x/2]^2]*Log[-1 + Tan[x/2]^2] - Log[Sin[x]^2]*Log[-1 + Tan[x/2]^2] + Log[Tan[x/2]^2]*Log[-1 + Tan[x/2]^2] + 2*PolyLog[2, (1/2)*Sec[x/2]^2] + PolyLog[2, Cos[x]*Sec[x/2]^2] + PolyLog[2, -Tan[x/2]^2] FullSimplify[(Limit[F[x], x -> Pi, Direction -> 1] - Limit[F[x], x -> Pi/2, Direction -> -1]) + (Limit[F[x], x -> Pi/2, Direction -> 1] - Limit[F[x], x -> 0, Direction -> -1])] 0 Or Integrate[f[x], {x, 0, z}, Assumptions -> Inequality[Pi/2, Less, z, LessEqual, Pi]] -(Pi^2/3) - 2*I*Pi*Log + Log^2 + 4*I*Pi*Log[Sec[z/2]] + 4*Log[-(Cos[z]/(1 + Cos[z]))]*Log[Sec[z/2]] + 4*Log[Sec[z/2]]^2 - 4*Log[Sec[z/2]]*Log[(-Cos[z])*Sec[z/2]^2] + 4*Log[Sec[z/2]]*Log[Sin[z]] - 2*Log[(-Cos[z])*Sec[z/2]^2]*Log[Sin[z]] + 2*Log[(-Cos[z])*Sec[z/2]^2]*Log[Tan[z/2]] + 2*PolyLog[2, 1/(1 + Cos[z])] + PolyLog[2, Cos[z]*Sec[z/2]^2] + PolyLog[2, -Tan[z/2]^2] Limit[%, z -> Pi, Direction -> 1] 0 Or Assuming[a >= 1, Integrate[f[a*x], {x, 0, Pi}]] (1/(3*a))*(-Pi^2 - 6*I*Pi*Log + 3*Log^2 + 6*Log[Cos[a*Pi]/(1 + Cos[a*Pi])]*Log[Sec[(a*Pi)/2]^2] + 3*Log[Sec[(a*Pi)/2]^2]^2 + 3*Log[Sec[(a*Pi)/2]^2]*Log[Sin[a*Pi]^2] - 6*Log[Sec[(a*Pi)/2]^2]*Log[-1 + Tan[(a*Pi)/2]^2] - 3*Log[Sin[a*Pi]^2]*Log[-1 + Tan[(a*Pi)/2]^2] + 3*Log[Tan[(a*Pi)/2]^2]*Log[-1 + Tan[(a*Pi)/2]^2] + 6*PolyLog[2, 1/(1 + Cos[a*Pi])] + 3*PolyLog[2, Cos[a*Pi]*Sec[(a*Pi)/2]^2] + 3*PolyLog[2, -Tan[(a*Pi)/2]^2]) Limit[%, a -> 1] 0 Integrate[f[x], {x, 0, Pi}, GenerateConditions -> False] 0 At last I found one case of the GenerateConditions->False setting that it is preferable than the default GenerateConditions->True (apart for issues of integration in the Hadamard sense and integrations where you know in advance for what parameters the integral converges). Unfortunately, I cannot find a reason to explain why Integrate[f[x],{x,0,Pi}] fails here. Even from the following plots: Show[GraphicsArray[Block[{$DisplayFunction = Identity},
(ContourPlot[Evaluate[#1[f[z] /. z -> x + I*y]], {x, -Pi, Pi}, {y,
-Pi, Pi}, Contours -> 50, PlotPoints -> 50,
ContourShading -> False] & ) /@ {Re, Im}]], ImageSize -> 500]

Show[GraphicsArray[Block[{$DisplayFunction = Identity}, (ContourPlot[Evaluate[#1[F[z] /. z -> x + I*y]], {x, -Pi, Pi}, {y, -Pi, Pi}, Contours -> 50, PlotPoints -> 50, ContourShading -> False] & ) /@ {Re, Im}]], ImageSize -> 500] Show[GraphicsArray[Block[{$DisplayFunction = Identity},
(Plot3D[Evaluate[#1[f[z] /. z -> x + I*y]], {x, -Pi, Pi}, {y, -Pi,
Pi}, PlotPoints -> 50] & ) /@ {Re, Im}]],
ImageSize -> 500]

Show[GraphicsArray[Block[{\$DisplayFunction = Identity},
(Plot3D[Evaluate[#1[F[z] /. z -> x + I*y]], {x, -Pi, Pi}, {y, -Pi,
Pi}, PlotPoints -> 50] & ) /@ {Re, Im}]], ImageSize -> 500]

Regards
Dimitris

dimitris, Nov 28, 2006