# Symbolic Integration along contour: branch cut problem?

Context

Following this question on path integrals in the complex plane, having defined again a numerical and symbolic integrator along a path as

 ContourIntegrate[f_, par : (z_ -> g_), {t_, a_, b_}] :=
Integrate[Evaluate[(f /. par) D[g, t]], {t, a, b}]


and

 NContourIntegrate[f_, par : (z_ -> g_), {t_, a_, b_}] :=
NIntegrate[Evaluate[D[g, t] (f /. par) /. t -> t1], {t1, a, b}]


when I try on this path

ParametricPlot[Cos[t] + I (Sin[t] + Cos[2 t]/2) // {Re[#], Im[#]} &, {t, 0, 2 Pi}]


I get numerically (note that I divide by $2\pi \imath$)

NContourIntegrate[1/x, x -> (Cos[t] + I (Sin[t] + Cos[2 t]/2)), {t, 0, 2 Pi}]/(I 2 Pi)

(* 1. *)


and symbolically (after a couple of minutes)

ContourIntegrate[1/x, x -> Cos[t] + I (Sin[t] + Cos[2 t]/2),
{t, 0, 2 Pi}]/(I 2 Pi) // N // Chop

(* 1.57088 *)


which suggests a branch cut problem in the symbolic solution(?) I have evaluated numerically the result of the above integration as it is a couple of pages long.

Note interestingly that this result is only equal to $\pi/2$ up to 4 digits!

Question

Could anyone please reproduce what seems to be a bug?

## UPDATE

In Mathematica 10.0.2 this problem is gone.

$VersionNumber  (* 10. *) ContourIntegrate[1/x, x -> Cos[t] + I (Sin[t] + Cos[2 t]/2), {t, 0, 2 Pi}]/(I 2 Pi) // N // Chop  (* 1. *) - ## 1 Answer The numeric result ($2π \cdot i\$) is correct by the residue theorem, since

In[25]:= Residue[1/x, {x, 0}]
Out[25]= 1


and your curve's winding number is 1, so

$$∮_{C} \frac{1}{z} \mathrm{d} z = 2π \cdot i \cdot \mathrm{Res}(1/z; z=0) = 2π \cdot i$$

So it looks like your symbolic ContourIntegrate is buggy.

-
Any suggestions on how to fix it? Also, why did you turn on Community wiki? – rcollyer Dec 1 '12 at 14:31
FYI the pb is gone in mathematica 10, which suggest my ContourIntegrate was not buggy :-) – chris Mar 26 '15 at 9:28