Welcome back to our cause now it's time to solve another interesting example, another interesting problem,
and this is a very famous problem it's cold calculating the magnetic fields of a charged wire.
So as you see here, we have a wire that is trade and the current flows from the negative to the positive
C direction in this blue wire here and already very early in school.
We are told that the magnetic field of such a wire looks like this.
So basically, it circulates around the wire.
And if you look in the current direction, so basically from the top to the bottom, then the magnetic
field will rotate along the clockwise direction.
If you look from the top, it's of course turn counterclockwise.
So that's maybe a bit of a similar example as the sphere that we have calculated previously.
So the volume of the sphere, because the volume of the sphere and also the magnetic field of such a
wire of both phenomena that we learned very early in school.
However, these phenomena are quite difficult to drive and to explain in detail.
But now, since we know the integrals, we can finally do it and here's how we do it.
We need the Maxwell equations of Magneto aesthetics.
So if you haven't heard about the Maxwell equations or Magneto statics, it's not a big problem.
We only need these two equations here.
So basically an integral equation and then also an equation that he uses to curl.
So this is something that we learned previously in the previous section about the derivatives.
So using the Maxwell equations of Magneto statics in their integral form, one can calculate the vector
potential of a so-called current density distribution.
So this word current density distribution is basically just a fancy word for all the currents in our
system.
So in our case, we just have a single current on the z axis.
So everyone on the z axis, we have a current and this wire here, it has a radius and it has an area.
If we cut through it and the density is, then just the current divided by the area of the cross section.
And this will then be our j of our where this j of R will be non-zero only on the z axis, only in the
wire, and it will be zero everywhere else because there are no currents.
And then from this we can basically integrate over this term here.
So this is something that one can derive.
We will not go into the details here, but this is the equation you can derive and you have to integrate
over the current density distribution divided by this term.
Where does the absolute value of art, which is the position at which we look currently, for example,
we can take a point in space this one here and we want to calculate the magnetic field at this particular
point, and we have to integrate over these terms and we integrate over DX v Dash.
And this means basically a triple integral to X, Y and Z.
And this dash here, our dash basically means we integrate of all the points in space.
And since the current density distribution is zero everywhere except for the wire, we only have to
integrate over the wire in this case.
So the R dashes are basically all the points of the wire.
So when you think about it, and integral is just something like a sum.
So you sum up this Ah, dash this our dash this, this this and so on and so on until you have the whole
integral.
And then we will, of course, plot this vector potential and look at it.
However, the vector potential is not a real physical quantity that we can use or that we can measure.
What we can measure is the magnetic field, and for this we have to calculate and the curl of the vector
potential.
And as I said, there are many more details here to consider.
And if you find this topic interesting, you can have a look at my other course.
It's called electrodynamics based on the Maxwell equations that we will really derive this equation,
and we will also solve this particular problem here analytically.
However, this course, we will solve it numerically, and this is how we do it.
First of all, we must, of course, run the cell here.
We must import Nampai and probably for plotting.
And then we will consider our host trade wire, which is this blue wire here.
And to solve the problem analytically, we would have to use some approximations.
So now we solve it numerically, so we don't need these approximations, but I still want to be very
close to the limits where we can.
Ladies approximation, so then we can compare the analytical solution with our numerical solution.
So first of all, we have to define some three factors.
I will not care about the numbers here.
I just set them to one.
And then we have to define the wire, so we need the the current density.
So as I said, current density will only be non-zero in the wire and zero everywhere else.
So the current density will have a value j0 here in the wire and it will be constant in this j0 is,
in our case, one.
And if you would use a unit, it would be something like unpair per square meter.
Then the wire has, of course, a radius, which is the limits where we can solve it analytically has
to be very, very small, so it must actually be infinitely thin.
So we take a small number here one millimeter and the length of the wire would be infinitely large in
the limit where we could solve it analytically.
So we need a very long wire, and I've just taken here one kilometer, which is actually very, very
long.
But OK, let's deal with such a long wire.
So actually, the way that I will program here is that the wire has a length starting from minus L0
going to plus L0.
So actually, the length is two kilometers here.
However, we will only consider the X y plane because if the wire would be infinitely large, then all
other planes would behave equally in our case, since we have a finite length.
It would, of course, depend a bit on the Z coordinate, but if we would say OK, we consider really
an infinitely large wire, then we only have to consider a single plane and every plane would look the
same.
So we consider here a to Z equals zero plane.
And then this one I told you already we have a very thin wire, so it has a radius are zero.
But basically the current density will be non-zero.
Only four X equals zero and Y equals zero, which is exactly the z axis.