Since I’m new to Mathematica I was looking for ways to learn vector integration and how to do them efficiently, so I came across this article where they did calculation for field in a point above a “slab” (magnetized bit) using Biot-Savart integration. To calculate following integral which is in vector form; I have problem defining parameters and variables. The integral is as following:
dH(r)= D \frac{\vec dl \times (\vec r_i' - \vec r)}{|\vec r_i' - \vec r|^3}
Once problem is defined, they end up with this integral for x direction (I assume one can difine similar for y and z).
H(r)=\sum_{i=1}^{4} C \int_{-l/2}^{l/2} \int_{0}^{1} \frac{\frac{\partial \vec r_i'}{\partial p} \times(\vec r_i'-\vec r)}{|\vec r_i' - \vec r|^3}dt dx
In my approach I call C and D constants and two vectors:
\vec r (field point) and \vec r_i' (source point), with \vec r = x \hat x + y \hat y + z \hat z and $\vec r_i’$vectors:
\vec r_1' (x,t) = (x \hat x + \frac{W}{2} \hat y + \frac{T}{2}\hat z)+ (-tW \hat y) = [x \hat x + (\frac{w}{2} - tW) \hat y + \frac{T}{2}\hat z]
\vec r_2' (x,t) = (x \hat x - \frac{W}{2} \hat y + \frac{T}{2}\hat z)+ (-tT \hat z) = [x \hat x - \frac{w}{2}\hat y + (+ \frac{T}{2} - tT)\hat z]
\vec r_3' (x,t) = (x \hat x - \frac{W}{2} \hat y - \frac{b}{2}\hat z)+(tW \hat y) =[x \hat x + (- \frac{W}{2} + tW) \hat y + \frac{T}{2}\hat z]
\vec r_4' (x,t) = (x \hat x + \frac{W}{2} \hat y - \frac{T}{2}\hat z)+(tT \hat z) =[x \hat x + \frac{W}{2}\hat y + (+ \frac{T}{2} + tT)\hat z]
where W is width of a “slab” in y direction and T is thickness of the slab in z direction. t changes from 0 to 1 and x changes from -l/2 to l/2
In Mathematica, I don’t know how to define variables within vectors and do the summation integration altogether. So my first attempt was to do individual form a individual piece of integral, for example for vector \vec r_1' in x coordinate in following way:
r := {x, y, z};
r1 := {x, W/2 - t W , T/2};
r1 - r = {0, W/2 - W t - y, T/2 - z}
D[r1, t] = {0, -W, 0}
Cross[{0, -W, 0}, {0, W/2 - W t - y, T/2 - z}] = {-((W T)/2) + W z, 0, 0}
Norm[r1 - r]^3 = (Abs[-1 + T/2]^2 + Abs[-1 + W/2 - W t]^2 + Abs[-1 + x]^2)^(3/2)
then when I put pieces to the integrate function:
Integrate[(-((W T)/2) + W z)/(Abs[W/2 - W t - y]^2 + Abs[T/2 - z]^2)^(3/2), {t, 0, 1}]
to calculate only for t variable it takes forever and gives me a conditional result. And I tried using assumption
Integrate[(-((W T)/2) + W z)/((W/2 - W t - y)^2 + (T/2 - z)^2)^(3/2), {t, 0, 1}, Assumptions -> W > 0 && T>0]
or generally
Integrate[Cross[D[r1, t], r1] /Norm[(r1 - r)]^3, {t, 0, 1}, Assumptions -> Im[W] == 0 && Im[T] == 0]
still lengthy integral. And I know doing like this is wrong, because the definitions are not correct and plus integral doesn’t even have x component which is basically useless to get the result similar to their. I know there must be a better way, maybe do numerical integration of vectors, or something, so I tried to search similar problems however, I couldn’t find anything useful. I would really appreciate if you show me the way you would define such problems to Mathematica and solve it efficiently.
If you want to look at the paper the DOI is provided below.
DOI:10.1007/s00542-011-1245-7
(this problem was posted in stack exchange too)


