Lesson 8 of 15

Magnetic Field of a Wire

Long Straight Wire

A current-carrying wire creates a magnetic field that wraps around it in concentric circles. The field strength at distance r from an infinite straight wire:

B = rac{mu_0 I}{2pi r}

  • B — magnetic field (tesla, T)
  • mu0=4piimes107mu_0 = 4pi imes 10^{-7} T·m/A — permeability of free space
  • I — current (amperes)
  • r — perpendicular distance from wire (m)

The Direction

Use the right-hand rule: point your thumb in the direction of current flow; your fingers curl in the direction of the magnetic field.

Simplification

Since mu0/(2pi)=2imes107mu_0 / (2pi) = 2 imes 10^{-7} T·m/A exactly, the formula simplifies to:

B = rac{2 imes 10^{-7} cdot I}{r}

Examples

I (A)r (m)B (T)
112.00e-07
1012.00e-06
10.12.00e-06
1000.54.00e-05

Your Task

Implement wire_magnetic_field(I, r) returning B in tesla (mu0=4piimes107mu_0 = 4pi imes 10^{-7}).

Pyodide loading...
Loading...
Click "Run" to execute your code.