I want to evaluate the integrals D1D_1 and D2D_2 defined below.

ax[ϵ_, Δ_, η_] := (

2*ϵ*Δ)/(ϵ^2 + Δ^2)*

Sin[(Δ*η)/2]^2;

ay[ϵ_, Δ_, η_] := Δ/

Sqrt[ϵ^2 + Δ^2]*

Sin[Δ*η];

az[ϵ_, Δ_, η_] :=

1 – (2*Δ^2)/(ϵ^2 + Δ^2)*

Sin[(Δ*η)/2]^2;

r1[ϵ_, Δ_, η_, θ_, ϕ_] := \

-ax[ϵ, Δ, η]*Cos[ϕ]*Cos[θ] –

a_y[ϵ, Δ, η]*Sin[ϕ]*

Cos[θ] +

a_z[ϵ, Δ, η]*Sin[θ];

r2[ϵ_, Δ_, η_, θ_, ϕ_] :=

ay[ϵ, Δ, η]*Cos[ϕ] –

ax[ϵ, Δ, η]*Sin[ϕ];

(*We choose θ = π/3 and ϕ = 0*)

D1[ϵ_, Δ_, ω_, τ_] =

Integrate[

Cos[ω*

t’]*(r1[ϵ, Δ, t – u, π/3 , 0]*

r1[ϵ, Δ, t, π/3 , 0] +

r2[ϵ, Δ, t – u, π/3 , 0]*

r2[ϵ, Δ, t, π/3 , 0]), {u, 0, t}, {t,

0, τ}]

D2[ϵ_, Δ_, ω_, τ_] =

Integrate[

Sin[ω*

t’]*(r1[ϵ, Δ, t – u, π/3 , 0]*

r1[ϵ, Δ, t, π/3 , 0] –

r2[ϵ, Δ, t – u, π/3 , 0]*

r2[ϵ, Δ, t, π/3 , 0]), {u, 0, t}, {t,

0, τ}]

When I execute the code, I get nothing. No output and no errors! What is wrong with the code?

You can find more details on the expressions at: https://arxiv.org/pdf/1604.06561v1.pdf. Page 6, left column.

P.S: I have no idea how to properly paste the code. I have been trying to copy (and paste) the code as “plain/input text” but to no avail. Please let me know how properly post my code.

Udpate: After the suggested edits (reflected in the code above), I get the following output:

I suspect the integrals haven’t been evaluated since the integral signs are still with the expression. When I exclude the expressions involing r1 etc, leaving behind only the Sin and Cos terms in the respective integrals, Mathematica evaluates the double integral. Issues?

The paper does evaluate the integrals. Shouldn’t Mathematica be able to reproduce the results? The results are:

=================

=================

1 Answer

1

=================

I found a syntax error in the beginning.

a_z -> az

a_y -> ay

Below is your code with modified a_z, a_y replaced with az, ay respectively.

ax[ϵ_, Δ_, η_] := (2*ϵ*Δ)/(ϵ^2 + Δ^2)*Sin[(Δ*η)/2]^2

ay[ϵ_, Δ_, η_] := Δ Sqrt[ϵ^2 + Δ^2]*Sin[Δ*η]

az[ϵ_, Δ_, η_] := 1 – (2*Δ^2)/(ϵ^2 + Δ^2)*Sin[(Δ*η)/2]^2

r1[ϵ_, Δ_, η_, θ_, ϕ_] := -ax[ϵ, Δ, η]*Cos[ϕ]*Cos[θ] –

ay[ϵ, Δ, η]*Sin[ϕ]*Cos[θ] + az[ϵ, Δ, η]*Sin[θ]

r2[ϵ_, Δ_, η_, θ_, ϕ_] := ay[ϵ, Δ, η]*Cos[ϕ] – ax[ϵ, Δ, η]*Sin[ϕ]

Now, in the paper they use the two variables t and t’. You are using t and u. This is good. As was mentioned in a comment t’ is the derivative and you don’t want to use that.

So let’s replace t’ in the integration code with u. Also in the paper they used π/2 so I will do that as well.

I also think you have the integration order swapped. You had the u variable followed by the t variable. When doing multiple integrals the outside integration variable should be in the first list. Check out the traditional form

HoldForm[Integrate[Cos[ω*u]*

(r1[ϵ, Δ, t – u, π/2, 0]*r1[ϵ, Δ, t, π/2, 0] +

r2[ϵ, Δ, t – u, π/2, 0]*r2[ϵ, Δ, t, π/2, 0]),

{t, 0, τ}, {u, 0, t}]] // TraditionalForm

Let’s see if we can get an analytical result

d1Int = Integrate[Cos[ω*u]*(

r1[ϵ, Δ, t – u, π/2, 0]*r1[ϵ, Δ, t, π/2, 0] +

r2[ϵ, Δ, t – u, π/2, 0]*r2[ϵ, Δ, t, π/2, 0]

),

{t, 0, τ}, {u, 0, t}]

We will define D1 using this result

D1[ϵ_, Δ_, ω_, τ_] := d1Int

And for D2

d2Int = Integrate[Sin[ω*u]*(

r1[ϵ, Δ, t – u, π/2, 0]*r1[ϵ, Δ, t, π/2, 0] –

r2[ϵ, Δ, t – u, π/2, 0]*r2[ϵ, Δ, t, π/2, 0]

),

{u, 0, t}, {t, 0, τ}]

D2[ϵ_, Δ_, ω_, τ_] := d2Int

Hope this helps. I leave it to you to check whether it matches the result from the paper.