# Magnetic field for certain distance

I have a question in theoretical physics. I have a magnetic field created by conductor loop

bz = (\[Micro] i )*8/(5 Sqrt[5] R);


with distance D = 2b and would like to show the norm of magnetic field as a plot with this distance and another bigger one. How can I simulate it in mathematica ? Would be grateful for help!

• Welcome to Mathematica Stack Exchange. Please take the tour and familiarize yourself with the kind of questions that attract high-quality answers. Jun 4, 2019 at 21:32
• The magnetic field is supposed to be a vector; you are only giving a scalar, presumably the $z$-component of the field. Please take a step back and show us more of what you are trying to do: what conductor loop, which "this" distance and which "another bigger" distance? As given, the problem is barely understandable even for an experienced physics teacher. Jun 4, 2019 at 21:34

I am not quite sure what you mean by "distance D = 2b". Do you mean that you want to set a constant radius R and plot the norm of your field at that radius, as a one-dimensional plot?

Otherwise you can plot the norm of the full field in some range och x- and y-coordinates. Btw, your function already gives you the norm of the field, since you are calculating the tangential component, which is the only non-zero one.

First, define the function, in Cartesian coordinates:

\[Mu]0 = 4 \[Pi]*10^-7; (* H/m *)
bz[x_, y_, i_] := \[Mu]0*i*8/(5*Sqrt[5]*Sqrt[x^2 + y^2])


Then plot it:

DensityPlot[bz[x, y, 1000], {x, -0.01, 0.01}, {y, -0.01, 0.01},
PlotRange -> Automatic,
ColorFunction -> "BlueGreenYellow",
PlotLegends ->
BarLegend[Automatic,
LegendLabel ->
Placed[Rotate["magnetic field strength [T]", -\[Pi]/2], Right],
LabelStyle -> {FontSize -> 32}, LegendMarkerSize -> 600,
Method -> {Frame -> True,
TicksStyle ->
Directive[Black, FontFamily -> "TimesNewRoman", FontSize -> 30,
AbsoluteThickness[2]]}],
Exclusions -> None,
ImageSize -> 700,
FrameLabel -> {Style["x [m]", FontSize -> 32, Black,
FontFamily -> "TimesNewRoman"],
Style["y [m]", FontSize -> 32, Black,
FontFamily -> "TimesNewRoman"]}]


Which gives you: