So now we can go ahead, and first of all, I want to define the current density.
So we already defined you, the prefecture, and I told you that this is basically constant.
So what we can do now is I could ride an if statement, for example, if the X coordinates of our vector
aren't positioned Vector Square plus our one square and then the square root and P Dot Square roads
is larger than zero, then it would be zero.
So then we return an array, which is just zero.
And in the other case, where opposition matter is at a point which has a radius smaller than zero,
then we would return an array which only has a Z component and the Z component is then j0.
However, I basically will make the problem here a bit more simple, and I will clean up the code more
because I already told you, according to this equation, we would have to integrate the our dash over
the whole space, and this will take a lot of time.
However, we know that our current density is only non-zero in the wire, so we will only integrate
over the z axis here.
So basically, we we don't even consider the other points in space that are far away from two C axes.
So this is why we will not not even have to use this if statement here we can just straight up return.
That's the current density.
Looks like this because we consider archeology only the wire.
OK, but it wouldn't be a problem if you would include these three lines of code here, it would just
make the code a tiny bit slower.
OK.
So what happens is when we call now our function for position vector on the z axis, for example, zero
zero five, then we get our own because I didn't run the zone and now it works, OK.
So if we are to position zero zero five, then our current density will be zero zero one, just as we
programmed to.
Now we must integrate.
So to do this, we must first prepare some lists.
And first I will prepare a coordinate list so the coordinates will be Kautz is equal to and p dot,
right?
So it will be an array, of course, and we can use know the mesh grid commands.
This is something that we used already for plotting, for example, when we plotted a density plot where
we had an x axis y axis and then the value for the z axis, which was a color.
And to generate the array for the X and Y coordinates we have used and mesh grids.
So now we can just define basically the lists for the values on the axes and then it will mesh and will
fill, then the whole space.
So we write, we mesh here.
Be like this and total in space, and we start from minus cordone at Max.
We go to cordon off Max and we have a certain number of points.
So you see, I program this year in a flexible way so that we can adjust these values later on.
And here I tested this before so that our code doesn't run forever and that we still get a nice convergence
for the integral later on.
So I choose these values here, and this is just the list for the x axis.
Now we need another list for the y axis and we need another list for the z axis.
However, I told you that we will only consider the X Y plane, so basically Z equals zero.
So this means we don't need this here.
We could, of course, use it to get a more accurate result for our particular problem, but I will
only calculate it for the X y plane.
So this is why I'm using here and zeroes one.
So this will be just a array with a single value at zero.
OK, so now we are finished with the coordinates and we can now test something, for example,
codes and these arrays will have no many indices and I can show you what they do.
First of all, these will be the coordinates X, Y and Z.
So I want to plot all of them here and then we can write in some points.
For example, divided by two.
So here's a problem this is a marked down, so I would go to the next cell instead.
No points divide it by two and then for the other index, also non-point, divided by two.
And then for the Z value, we'll just take the only index that we have.
Zero.
So this will be the output for this particular point.
So the index in this case would be 25 25 zero.
And for the first index, we take all three, so basically going zero, one and two.
And this is the output.
The X coordinate that corresponds to this value is zero point one zero point one zero.
It c.
When we change this index, we get an arrow because we only have a single point in the Z direction.
And here we can, for example, subtract one along the X direction and you see that there is a problem,
but you see that this value here goes from plus zero point one to minus 0.1.
However, here's a problem because actually I wanted to change here the X coordinate.
However, the Y coordinate changed, and this is something that's very odd about and mesh grid, because
if you take just two lists here, it will First Order or the the indexing will first be the y axis and
then the x axis.
And then when you take another one, then comes the z axis.
So that's actually a very, very odd.
So I can write down here so that you remember standard indexing is for whatever reason, I cannot tell
you it makes no sense in my eyes.
So not indexing is first.
Why then x stanza?
It makes no sense.
However, we can fix this.
Fixed by using
indexing is equal to I.J.
That's also something that I had to look up because I run into problems here because the indexing was
incorrect so we can write it down like this.
And now I know it should work.
Yes.
So for example, we can now write, print this one and then print another, output
this one.
And you see, these are our numbers.
First output is minus zero point one zero point one zero and then zero point one zero point one zero.
So this maybe also explains to you why I've chosen these values here.
I explicitly wanted to exclude the values zero for X and zero for Y, and the reason is we will integrate
our dash over the z axis were X and Y are both zero.
So if we would consider X0 and y0 for our, then we would have the case where we divide by zero.
And that's something you really have to avoid.
And this is why I have not included Devalues zero.
Here, so I'm going here in steps of two, as I'm sorry of 0.2, and we have a nicely dense array here
of coordinates, but we exclude the point zero zero.
Now we do the same thing for the vector potential.
So first, we start with an empty array or empty list, and we can actually just copy this here and
just give it a different name.
A, for example.
So now we have empty lists for the coordinates and as no, not not empty list for the coordinates,
but these or any of these values of the coordinates.
And for a actually, we don't need the same as for the coordinates, but we need an empty list.
So instead of this one, I will write, I will write and peter the zeros and then number of points.
This will be a list of length nom points where the values are all zeros at the same for the Y coordinates.
And here, let's make this a bit nicer.
Don't know what happened here?
And here we go.
OK, now we have it, and now we can, for example, check what we right here A and E.
We should get three zeros in both cases because we haven't calculated a yet.
OK, so now we have everything set up.
Now we can do the integration.