So in the previous lecture, we have set up diaries for coordinates and for defector potential, which
is still empty, so only zeros.
And now we can actually carry out the integral here.
So we will do this now, and I told you already that we will not integrate over the whole space with
just over the wire.
So just over the sea access from zero negative to positive other n0.
So first of all, we need a number for the integration steps.
So basically, how many points do we put into the wire?
And they check that it gives us a nicely converged result for five thousand or five thousand and one
when we have one to have a nicely spaced list here.
So you see the length is two times one thousand and the numbers of steps that we have is five thousand
and one, and now we can do our loop.
So for index for the X coordinate in and P Dot arrange num points and the same for Y, of course.
So this will be then in the loop over the X and Y coordinate of the normal position vectors of this
one here or also of this one.
So we will go now through the whole space and there we will ask, OK, what's the value of a what's
the value of B later on?
So for example, here this will be one of the points in this theory that we try to fill now.
So here we go.
This is now the position of port position are for which we are currently calculating the vector potential
eight and so are is given by MP Dot Perry.
We could now call it just from from courts, but we can also reconstruct that it doesn't really matter
in terms of calculation times or much.
So I just tried minus court max plus i x times D.
And then we have minus courts.
Basically the same thing here, just with the high wire city index for why.
And we said that U.S. values should always be zero.
So I don't remember, did we define already the value of these?
No, we forgot it.
So the value of that I'm using here is the step size and the step size, of course, is directly calculated
from these two numbers.
It's calculated by DH is equal to two times called MAX, divided by number of points minus one.
So in our case, it is two times four point nine, divided by 49.
So it is 0.2 and you can expect these leaders.
This is true here.
Step sizes 0.2.
OK.
So, of course, I have to run these cells now again because we changed them.
And now we can continue writing the code here.
So we have no defined the position vector and now we must start the integration for this particular
position vector.
So for C.J., so this will be the z coordinate of the position vector that corresponds to the current.
So this will be the z component of this, our dash and also this one here.
So I labeled it Z J.
This particular index z j in and P totally in space going from minus L0 to positive at zero in steps
of no end.
So basically, this will go the number of steps that we have in this range here and now we finally do
the integration.
So we integrate over all
our
dash in the wire.
So we called his Ardeshir RJ because I don't like the dash here for programming, so let's call it RJ
for our current density.
And this will be ENPI Dot three
zero zero and then C j and now we can do it, we can write a.
And here we write all the coordinates and then the value of the index for the X Coordinate Index for
the Y Coordinate Index, for the Z coordinate, which is zero.
And now we can just write is equal to the old one because we integrate.
This will be basically a sum here, plus the change, which will be what is written down.
Where is it here?
This one?
So j at this position divided by the absolute value of the difference you.
So we write J of our J divided by and then we could write the appeal and I can all or we can also just
do it ourself and fiddle with the square root,
our zero squared.
So now it's pretty easy to calculate the absolute value of the difference because this one here only
has an X and Y coordinates.
And this one here only has a Z coordinates, so there's actually not really a difference.
We can just write down like this
and then RJ to square.
But of course, you could also write here and in our top norm of army notes, RJ would give you the
same result.
OK, so now this should work.
I think because we integrate over this, oh, I forgot to write the return.
So no, it's no sorry.
I was confused here for a second.
I thought I would have forgotten to write the return.
But this is not a function.
This is just a loop, so we don't need any return.
So this is just good to go.
And you see, because I already used quite a large number.
The calculation takes some time.
So if you have a bit of a weak computer or laptop, then please reduce the number, maybe go to five
hundred and one because otherwise you will sit forever.
And if you take a lower value here, then your result will not be as accurate as mine.
But that's not really a big problem.
It's just here.
So we get the general results correct.
So it's not a big deal if you don't have accurate numbers.
So you can use here a bit of a smaller value as well.
And especially when you first test these code.
And also this is what I did when I prepared the notebook.
I, of course, started here with a much smaller value.
So now one thing that we are still missing is while this is running, I can explain this to you.
We are still missing the prefecture and we did not account for the size of this integration element
DV.
So by the way, now the calculation is finished, but we need to still calculate something.
So a must actually be multiplied with the prefecture, which is mile zero, which was one and then divided
by four times PI.
And then we must calculate the DV element.
This would be basically d x times d y times.
The Z and the Z is pretty easy.
This is just two times the length of a wire divided by the number of our integration steps.
So now and minus one and the X and Y are both the same.
This would be pretty similar, actually two times code MAX divided by NUM points minus one and then
the same for d y.
However, I don't want to do it like this.
This would be like the you could see the brute force way of calculating this, because this would really
correspond to the numerical integration.
But actually, what this would do when you think about it, it would put our wire here in cubes so you
would have no cubes or Q boards that are stacked on top of each other.
And so the cross-section would then just be a square where the edges are given basically by the value
of of the of the size here D.
And this is, of course not what we want.
We want that.
We have really our a cross section, which is a circle and where the radius is given by our value.
So we are maybe cheating here a bit in terms of numerics.
But you could also say we are just clever because we are physicists and we know what the radius will
be.
So.
Let me comment off these lines here because because this is not what we will use.
Instead, we will introduce a new element, which will be the element of the of the area.
So I call this d f and this will be, of course, the radius or the area of the circle with the radius
r zero.
So and p told pi times r zero squared.
And then we can calculate a by writing eight is eight times the prefect.
Our times the easy times t f.
OK, so then we will get a much better result.
So this calculation has finished and now I run this cell for the normalization of the result.
And now we can finally go ahead and plot this whole thing.
So as typically, we will use some of these options here for plotting, I will make the aspect ratio
equal to one.
And I will add here a label for X and Y, and then I will go ahead and plot the vector potential.
So for this, I will use a control plot.
So basically, we are the value of the vector potential is given by the color.
And so the X, the list of the X well use will be co-ords zero and all X or Y, and only the plane where
Z is equal to zero, then the wireless will basically be the same, but of course, with the Y component
here.
So we change this to one.
And now we must include the value of eight.
And for a I can first use the X component of A.
So then all X or Y and only if the plane was equal to zero.
And when I run this, it gives me just a plain color, which indicates that probably all the values
o zero, we cannot cross chapters by adding here a color bar.
So kielty that color bar.
And you see, yes.
So it's very small, so all the values here are zero.
Now we can check for the Y coordinate with Y component better to say also zero.
But the Z component is on zero and that's the one that we are interested in.
So this is now the z component of the vector potential.
Let me write this down here.
So this is the C bar and we will change to C Bar set label.
And this is the vector potential A to Z components.
All right.
So this is the result of our first integration or this is the integration that we want to do.
So we integrated this equation here over divides and divides included all the points in the wire and
we did the approximation that the wire is only on the z axis and we considered a radius, which was
the 0.001.
And you see that the vector potential is largest here in the middle and then it declines when you go
away from the z axis.
So not just some comments about the analytical solution.
So I told you already earlier that in my other course on the Maxwell equations, we solved this problem
analytically.
So you don't have to understand what's shown here, but I just want to show it to you that it's possible
to solve this analytically.
And basically, we do hear a similar thing.
We integrate, of course, over the current density, which we assume to be constant in the wire so
we can pull it out of the integral.
And so we basically only integrate of army knows our dash, and this will be something like a square
root.
And if you integrate over such a thing, it will give you the logarithm.
And so I have programmed this equation here.
So the analytical solution is written down here again.
This I programmed and I cut basically through the through our plot here along this line.
So for Y equals zero or close to zero because we didn't have the value of zero in our list.
But I've chosen zero point one and I've cut through this line and plot now the vector potential to Z
component.
And you see as you see the blue values, all the ones from our numerical calculation, which is the
same that are shown here.
So just cut through this and then look at the color.
This will give you the same values.
And then the red line that I've programmed using this equation, which is the same as I've just shown
you this one here.
This gives you these red lines and you see we have a pretty nice agreement.
There is maybe a small problem here directly in the middle, but that's pretty clear because, yeah,
there are we have maybe not enough points for our integration and for considering all the points in
this space, but overall, it's a pretty remarkable result.
And we got the vector potential correct.