A solenoid consists of a helically winding wire on a cylinder, usually circular in cross section. While at a considerable distance from the solenoid?s ends, magnetic field B is uniform, and it equals to B = μ0In = μ0IN/l, where μ0 = 4π?10-7 N/A2 is a magnetic constant, I is the current in the wire, N is the number of turns, and l is the length of the solenoid. The direction of the magnetic field coincides with the direction of the current in accordance with the right-hand rule. The magnetic field loses its uniformity next to the ends of the solenoid. It decreases in magnitude, and the magnetic field lines are diffused outside of the solenoid.