I am calculating the following Biot-Savart integral according to the suggestion of @Ulrich Neumann in a previous post called Biot-Savart Integral:
(*p[\[Theta]] represents the path to map the curved portion of the \
saddle coil*)
p[\[Theta]_] := {d/2 Cos[\[Pi]/3 - \[Theta]], 0,
d/2 Sin[\[Pi]/3 - \[Theta]]};
(*FP is the final point at which I want to calculate the field.*)
FP = {x, y, z};
R = FP - p[\[Theta]];
(*The unit vector from R*)
ar = R/Sqrt[R.R];
(*Bx, By,Bz*)
{Bx, By, Bz} = \[Mu]0/(4 \[Pi])*
Integrate[
Cross[D[p[\[Theta]], \[Theta]], ar]/(R.R), {\[Theta], 0,
2/3 \[Pi]}, GenerateConditions -> False]
The formula implemented by the code is:
where the vector R connects the element of current to the final point:
(the \theta angle in figure is not the same present in the code) If FP is for example the point of coordinates FP={0,h/2,0} (centre of the saddle coil), the code returns the solution quite fast. However, If I set FP={x,y,z} to find the magnetic field at a generic point of coordinates {x,y,z} it runs for several minutes (~>10) and then returns the following answer:
{(1/(4 \[Pi]))\[Mu]0 Integrate[(d y Sin[\[Pi]/6 + \[Theta]])/(
2 (y^2 + (z - 1/2 d Cos[\[Pi]/6 + \[Theta]])^2 + (x -
1/2 d Sin[\[Pi]/6 + \[Theta]])^2)^(3/2)), {\[Theta], 0, (
2 \[Pi])/3}, GenerateConditions -> False],....}
which makes me thinking that Mathematica performs the derivative D function but it is not doing the integral. Is there a way in which I can perform the integral? p.s.: The code runs very smoothly and produces the correct answer even for FP={x,y,z} for the case for which the path is a linear segment of the form d[s]:=(1-s)A+sB rather than acurved path p[[theta]] as reported above.
NIntegrate
if numerical answers are OK. (2) Mathematica might be able to find the answer if you integrate over the full circle rather than just an arc, since there are various integration techniques that can work over a full circle but not an arc. (3) ProvidingAssumptions
about the parametersd
,x
,y
,z
may help; by default, Mathematica will assume they're complex numbers... $\endgroup$