Vectors and Coordinate Systems for Fields
A circuit has a handful of node voltages; a field has a value at every point of space. To describe the electric field around a coaxial cable, the magnetic field inside a toroid or the wave leaving an antenna, you need three things this lesson sets up: vectors written in components, the three coordinate systems that match the shapes engineers build (boxes, cylinders, spheres), and the small length, area and volume elements that every field integral in the course is built from. The maths is in Vectors, The Dot Product, The Cross Product, Cylindrical Coordinates and Spherical Coordinates; here we use it the way field problems need it.
Vectors in components
A vector field assigns a vector to every point, for example in volts per metre. In Cartesian coordinates
Two products appear in every chapter. The dot product takes the component of one vector along another: work , flux , power . The cross product is perpendicular to both, with magnitude and the right-hand rule for its direction: the magnetic force , the Biot–Savart law , the Poynting vector .
The vector you will write most often is the distance vector from a source point (where a charge or current sits) to a field point (where you want the field):
Primed coordinates mark the source, unprimed the observer. Getting the order wrong flips every field you compute.
Three coordinate systems
Cylindrical : is the distance from the axis, the angle from the axis in the -plane, the height. Use it for wires, coaxial cables, solenoids and anything with an axis. Spherical : is the distance from the origin, the polar angle measured from the axis ( to ), the same azimuth as in cylindrical. Use it for point charges, spheres and antennas far away. The conversions are
The important difference from Cartesian coordinates is that , , and change direction from point to point. They are still orthonormal at each point, so dot products work component by component, but you cannot pull them out of an integral as constants: around a circle is zero, not . Convert to before integrating a vector.
Converting a vector (not just a point) means projecting it on the new unit vectors at that point:
Length, area and volume elements
Integrals of fields add up contributions over small pieces of a path, surface or volume. A small step in a coordinate does not always move you the same distance: a step moves you in cylindrical and in spherical coordinates. These scale factors appear in every element:
| System | Typical | ||
|---|---|---|---|
| Cartesian | on a plane $z = $ const | ||
| Cylindrical | on a cylinder $\rho = $ const | ||
| Spherical | on a sphere $r = $ const |
A vector surface element points along the outward normal of a closed surface. Check any element by integrating it over a familiar shape: , the area of a sphere.
Worked example
Given: a field point at and, at , the vector (in any unit, say ). A point charge sits at .
Find: the cylindrical and spherical coordinates of , the components of in both systems, and the unit vector from the charge to .
Solve:
Check: the length of a vector does not depend on the coordinates: and , equal to .
In Python
The conversions are a few lines of NumPy. The second part checks the volume element by adding up over the dielectric of a coaxial cable (inner radius , outer radius ) and comparing with the exact .
import numpy as np
def to_cyl(x, y, z):
return np.hypot(x, y), np.arctan2(y, x), z
def to_sph(x, y, z):
r = np.sqrt(x*x + y*y + z*z)
return r, np.arccos(z / r), np.arctan2(y, x)
def vec_cart_to_cyl_sph(A, x, y, z):
rho, phi, _ = to_cyl(x, y, z)
r, th, _ = to_sph(x, y, z)
Ax, Ay, Az = A
Arho = Ax*np.cos(phi) + Ay*np.sin(phi)
Aphi = -Ax*np.sin(phi) + Ay*np.cos(phi)
Ar = Arho*np.sin(th) + Az*np.cos(th)
Ath = Arho*np.cos(th) - Az*np.sin(th)
return (Arho, Aphi, Az), (Ar, Ath, Aphi)
P = (1.0, 2.0, 2.0)
rho, phi, z = to_cyl(*P)
r, th, _ = to_sph(*P)
print(f"cylindrical: rho = {rho:.3f} m, phi = {np.degrees(phi):.2f} deg, z = {z:.1f} m")
print(f"spherical: r = {r:.3f} m, theta = {np.degrees(th):.2f} deg")
cyl, sph = vec_cart_to_cyl_sph((3.0, 4.0, 0.0), *P)
print("A cylindrical:", [round(float(v), 3) for v in cyl])
print("A spherical: ", [round(float(v), 3) for v in sph])
print(f"|A| in both: {np.linalg.norm(cyl):.4f}, {np.linalg.norm(sph):.4f}")
R = np.array(P) - np.array([0.0, 0.0, 1.0])
print("R-hat =", np.round(R / np.linalg.norm(R), 3))
# volume of a coax dielectric per metre by summing rho*drho*dphi*dz (midpoint rule)
a, b, L = 0.45e-3, 1.475e-3, 1.0
n = 200
rho_mid = a + (np.arange(n) + 0.5) * (b - a) / n
V_sum = np.sum(rho_mid * (b - a) / n) * 2*np.pi * L
V_exact = np.pi * (b**2 - a**2) * L
print(f"dielectric volume: sum {V_sum*1e6:.4f} cm^3, exact {V_exact*1e6:.4f} cm^3")cylindrical: rho = 2.236 m, phi = 63.43 deg, z = 2.0 m
spherical: r = 3.000 m, theta = 48.19 deg
A cylindrical: [4.919, -0.894, 0.0]
A spherical: [3.667, 3.28, -0.894]
|A| in both: 5.0000, 5.0000
R-hat = [0.408 0.816 0.408]
dielectric volume: sum 6.1988 cm^3, exact 6.1988 cm^3
The sum of over thin rings gives the exact area, because the midpoint rule is exact for a linear integrand; leave out the factor (a common slip) and the result is off by a factor equal to the mean radius, and in square metres instead of cubic metres.
Guided lab: the dielectric of a coaxial cable
The coaxial cable comes back in Gauss's Law for Symmetric Charge Distributions, Capacitance of Common Geometries and the mini project, so it is worth measuring one now.
Hand calculation. For a thin cable with a centre conductor and a solid polyethylene dielectric, the cross-section of the dielectric is , so of it holds . With polyethylene at about that is .
Simulation. The Python sum above reproduces the volume to four figures.
What you would measure. Cut of cable, strip the jacket and braid, and measure both diameters with a caliper at three places (resolution ; expect a scatter of about to ). Pull the centre conductor out and weigh the dielectric on a scale. A uncertainty in each radius gives about in the area; the scale's is another , so agreement within about is the expected result. Foamed dielectrics weigh much less: if your sample comes in at a half or a third of the prediction, it is foam, and its permittivity will be lower too.
Hazards and safe setup. No electricity is involved. Use a cable stripper or cut away from your hand, and wear eye protection when snipping braid strands.
Pitfalls
- Unit vectors that move. at is ; at it is . Never integrate a vector field written in , , , without first asking whether the unit vector is constant over the region.
- Two different . In this course alone is the cylindrical radius; charge densities always carry a subscript: (volume), (surface), (line).
- and swapped. Engineering and physics books use from the axis and for the azimuth, as here; many mathematics texts swap them. Check before copying a formula.
ataninstead ofatan2. loses the quadrant: the point is at , not .
Practice
- Convert to cylindrical and spherical coordinates.
- At , the field is . Write it in Cartesian components.
- Using in spherical coordinates, find the volume between and inside the cone .
- A charge at and a field point at : find and .
Answer
- , , ; , .
- , so .
- .
- , , .
Test yourself
In spherical coordinates, a small step in azimuth moves a point by a distance…
Why can't you write ?
- is not a unit vector
- changes direction with , and the integral is actually zero
- the integral should be over , not
- has no component
A source charge sits at and you want the field at . The distance vector in Coulomb's law is…
The point in spherical coordinates is…
- , ,
- , ,
- , ,
- , ,