# Electricity and magnetism

## Contents

# Electricity and magnetism#

Gravity, Magnetism, and Orbital Dynamics

This notebook will cover the basic principles, concepts and quantities surrounding the electric and magnetic fields. Electromagnetism is at the forefront of physics and engineering and is thus vital for any aspiring physicists and engineers to have a deep understanding of these concepts.

## Coulomb’s law and the electric field#

A stationary charge \(q_1\) at position \(\mathbf{r_1}\) produces a force on a charge \(q_2\) at \(\mathbf{r_2}\). Coulomb’s law describes this electrical interaction between two electrically charged particles in terms of the forces they exert on each other. This is given by

where \(\mathbf{r_{12}} ≡ r_2 − r_1\) and \(r_{12} = \mathbf{\left|r_{12}\right|}\).

The electric field, \(\mathbf{E(r)}\), of a charge illustartes how the electric force exerted by the charge on another charge varies with space. The field at a point \( \mathbf{r}\) due to a charge, \(q_1\) that has always been at \( \mathbf{r_1}\) is defined as

Now place a charge, \(q_2\), in the field. Using the 2 above definition we can see that the force exerted on \(q_2\) is related to the electric field by

For a system containing \(n\) charges we can use the principle of superposition to show that the electric field of the system is

Below, the electric field, due to a positive point change at the origin, is plotted. The length of the arrows is an indication of the strength of the electric field at that point.

```
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
params = {
'axes.labelsize': 20,
'font.size': 20,
'figure.figsize': [10, 10]
}
plt.rcParams.update(params)
def E(x,y):
q= 1 #Charge in coulombs
r1 = sp.array([0,0]) #Charge set at origin
e0= 8.85*10**(-12) #permetivity of free space
mag= (q / (4 * sp.pi* e0)) * (1 / ((x - r1[0])**2+ (y - r1[1])**2)) #Magnitude of Electric Field Strength
ex= mag * ( np.sin(np.arctan2(x,y)))
ey= mag * ( np.cos(np.arctan2(x,y)))
return (ex,ey)
x=sp.linspace (-10,10,14)
y=sp.linspace (-10,10,14)
x,y=sp.meshgrid(x,y)
ex,ey=E(x,y)
plt.quiver(x,y,ex,ey, scale = 15000000000, color="red")
plt.show()
```

## Electric potential#

Consider a charge \(q\) in the electric field of another charge \(Q\). The charge \(q\) experiences a force, \(\mathbf{F}_Q\), due to the electric field. Now consider moving \(q\) from \(A \rightarrow B\) at constant speed. A force, \(\mathbf{F}_{ext}\) must be applied to match \(\mathbf{F}_Q\).Thus, in moving the charge the external force does work. Moving at constant speed

and thus the work done by \(\mathbf{F}_{ext}\) on \(q\) is

Thus, the total work done by \(\mathbf{F}_{ext}\) is found by integrating from A to B

The work done, \(W\), is equal to the change in potential energy, \(∆U\), and so

Using Coulombs law and carrying out the integration we find

and so the change in potential energy depends only on the radial seperation, r. Thus, \(∆U_{AB}\) is path independent, meaning that the shape of the path does not matter on the change of potential energy.

### Potential difference#

The potential difference between \(A\) and \(B\) is \(∆V_{AB}\) where

\(∆V_{AB}\) is also path independent, and does not depend on \(q\) with an SI unit of \(JC^{−1}\). By choosing \(V = 0\) as \(r \rightarrow \infty\), we define the electric potential, \(V\), at \(P\) as the external work needed to bring a charge of \(+1 C\) at constant speed from \(r = ∞ \,(V = 0)\) to \(P\):

Key facts about \(V\): it is the potential energy / unit positive charge; it is a scalar field; and the superposition principle applies. With no external forces applied, positive charges move to lower potentials and negative charges move to higher potentials. For a point charge \(Q\), the potential \(V\) at \(r\) from \(Q\) is:

## Magnetic flux#

The magnetic field is represented by the letter \(\mathbf{B}\). Similarly to the electric field, \(\mathbf{B}\) is a vector field and has units of Tesla, \(T\). An important quantity is the magnetic flux, \(\mathbf{\Phi}\), defined as

where \(\mathbf{S}\) is the vector pointing out of the surface under question. Thus, \(\mathbf{\Phi}\) is the magnetic flux through a surface and has units of Weber, \(Wb\) (\(Tm^2\)).

## Lorentz force#

The Lorentz force describes the force experienced by a charged object with charge \(q\) inside an electric and a magnetic field and is given by

where \(\mathbf{v}\) is the velocity of the charged object. Assuming no electric field and a constant magnetic field, the particle will experience a perpendicular force to its motion where \(\mathbf{F} = \mathbf{F(v)}\). Thus \(\mathbf{B}\) is also a conservative quantity.

## Magnetic dipole moment#

Wires carrying a current have moving charges and thus current-carrying wires in a magnetic field can experience a force

where \(n\) is the charge density (\(m^{-1}\)). Current often flows in closed loops. Thus we define a new vector quantity, the *magnetic dipole moment*, \(\boldsymbol{\mu}\):

where current \(I\) flows in a loop of area \(A\). \(\mathbf{A}\) is a vector based on the right hand rule on current. A magnetic field will exert a torque, \(\mathbf{\Gamma}\), on a current loop

Thus, magnetic fields exerts a torque on magnetic dipoles.