6
$\begingroup$

I am trying to check using Mathematica the following result: $$-\frac{1}{4\pi^2}\int_{0}^{2\pi}\int_{0}^{2\pi}\int_{0}^{2\pi} \mathbf{F}\cdot\mathbf{A}\;dk_x dk_y dk_z=1,\quad\text{where}$$ $$z_{\uparrow}=\sin k_x+i\sin k_y,\quad z_{\downarrow}=\sin k_z+i(\cos k_x+\cos k_y+\cos k_z-3/2),$$ $$\mathbf{A}=i(z_{\uparrow} \; z_{\downarrow})^{*}\mathbf{\nabla} (z_{\uparrow} \; z_{\downarrow})^{\intercal},$$ $$\mathbf{F}=\mathbf{\nabla}\times\mathbf{A}.$$

So far I wrote

zup0 = Sin[kx] + I Sin[ky];
zdo0 = Sin[kz] + I (Cos[kx] + Cos[ky] + Cos[kz] - 3/2);

zup = zup0/Norm[{zup0, zdo0}] // ComplexExpand // Simplify;
zdo = zdo0/Norm[{zup0, zdo0}] // ComplexExpand // Simplify;

ax = I Conjugate[{zup, zdo}]. {D[zup,kx], D[zdo,kx]};
ay = I Conjugate[{zup, zdo}]. {D[zup,ky], D[zdo,ky]};
az = I Conjugate[{zup, zdo}]. {D[zup,kz], D[zdo,kz]};

fx = D[az,ky]-D[ay,kz];
fy = D[ax,kz]-D[az,kx];
fz = D[ay,kx]-D[ax,ky];

integrand = ax fx + ay fy + az fz;

result = NIntegrate[integrand, {kx,0,2Pi}, {ky,0,2Pi}, {kz,0,2Pi}]

This code returns the non-numerical value error and I suspect that this happens because of the clumsy use of Conjugate and D. How can I fix the problem? I will also appreciate further suggestions to improve my code, including how to use ComplexExpand and Simplify to enhance computational efficiency.

$\endgroup$

2 Answers 2

4
$\begingroup$

There are multiple improvements for your code, the most obvious ones being you could use Grad and Curl to compute {ax,ay,az} and {fx,fy,fz} in one line each, and also use Normalize for {zup0,zdo0}. Combining all of this, your code can be "vectorized" to be much more concise and mathematical-looking.

You also may want to use Simplify to simplify intermediate expressions assuming 0<kx,ky,kz<2Pi, instead of using ComplexExpand, to avoid having Conjugate's and Arg's popping up everywhere.

With all of the above, Mathematica can check the identity albeit after some hard numerical integration work:

z = {Sin[kx] + I Sin[ky], Sin[kz] + I (Cos[kx] + Cos[ky] + Cos[kz] - 3/2)}//Normalize//ComplexExpand//Simplify;

a = I Conjugate[z] . Grad[z, {kx, ky, kz}]//Simplify[#, 0 < kx < 2 \[Pi] && 0 < ky < 2 \[Pi] && 0 < kz < 2 \[Pi]] &;

f = Curl[a, {kx, ky, kz}]//Simplify[#, 0 < kx < 2 \[Pi] && 0 < ky < 2 \[Pi] && 0 < kz < 2 \[Pi]] &;

integrand = a . f // Simplify;

NIntegrate[integrand, {kx, 0, 2 Pi}, {ky, 0, 2 Pi}, {kz, 0, 2 Pi}]
(*-39.4784*)
```
$\endgroup$
1
$\begingroup$

Integrate localizes its variables. Therefore the variables kx,ky,kz in integrand and the integration variables of NIntegrate are not the same. What you can do is to write integrand as a function like:

integrand[kx_, ky_, kz_] = ax fx + ay fy + az fz;
result = NIntegrate[
  integrand[kx, ky, kz], {kx, 0, 2 Pi}, {ky, 0, 2 Pi}, {kz, 0, 2 Pi}]

However, there is a more serious second problem. The derivative of Conjugate is not defined. You need to rewrite this without using Conjugate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.