While trying to compute winding number, i find that Integrate and NIntegrate are giving apparently different answers. Below is the code that i tried:
Clear[μ, λ1, λ2, θ1, θ2, Δ, ϵ, k];
$Assumptions = True;
$Assumptions = {μ, λ1, λ2, θ, k} ∈ Reals;
μ = -2;
ϵ[k_] := -2 λ1*Cos[k] - 2 λ2*Cos[2 k];
Δ[k_] := λ1*Sin[k] + λ2*Sin[2 k];
θ1[k_] := ArcTan[(ϵ[k] - μ)/Δ[k]];
λ1 = 2.5;
λ2 = 0;
Integrate[θ1'[k], {k, -π, π}]
NIntegrate[θ1'[k], {k, -π, π}]
λ1 = 0;
λ2 = 1.5;
Integrate[θ1'[k], {k, -π, π}]
NIntegrate[θ1'[k], {k, -π, π}]
And it gives following output:
3.14159
6.28319
0.
12.5664
It would be extremly helpful if someone can explain as to what is wrong with it?
2.5
,1.5
) with exact solvers (e.g.Integrate
) sometimes fails. TryRationalize[]
as a remedy or enter parameters as fractions. $\endgroup$