There was an error in this gadget

## Mathematical description

There are different mathematical ways of representing the electromagnetic field. The first one views the electric and magnetic fields as three-dimensional vector fields. These vector fields each have a value defined at every point of space and time and are thus often regarded as functions of the space and time coordinates. As such, they are often written as $\mathbf{E}(x, y, z, t)$ (electric field) and $\mathbf{B}(x, y, z, t)$ (magnetic field).
If only the electric field ($\mathbf{E}$) is non-zero, and is constant in time, the field is said to be an electrostatic field. Similarly, if only the magnetic field ($\mathbf B$) is non-zero and is constant in time, the field is said to be a magnetostatic field. However, if either the electric or magnetic field has a time-dependence, then both fields must be considered together as a coupled electromagnetic field using Maxwell's equations.[1]
With the advent of special relativity, physical laws became susceptible to the formalism of tensors. Maxwell's equations can be written in tensor form, generally viewed by physicists as a more elegant means of expressing physical laws.
The behaviour of electric and magnetic fields, whether in cases of electrostatics, magnetostatics, or electrodynamics (electromagnetic fields), is governed in a vacuum by Maxwell's equations. In the vector field formalism, these are:
$\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}$ (Gauss's law)
$\nabla \cdot \mathbf{B} = 0$ (Gauss's law for magnetism)
$\nabla \times \mathbf{E} = -\frac {\partial \mathbf{B}}{\partial t}$ (Faraday's law)
$\nabla \times \mathbf{B} = \mu_0 \mathbf{J} + \mu_0\varepsilon_0 \frac{\partial \mathbf{E}}{\partial t}$ (Ampère-Maxwell law)
where ρ is the charge density, which can (and often does) depend on time and position, ε0 is the permittivity of free space, μ0 is the permeability of free space, and $\mathbf J$ is the current density vector, also a function of time and position. The units used above are the standard SI units. Inside a linear material, Maxwell's equations change by switching the permeability and permittivity of free space with the permeability and permittivity of the linear material in question. Inside other materials which possess more complex responses to electromagnetic fields, these terms are often represented by complex numbers, or tensors.
The Lorentz force law governs the interaction of the electromagnetic field with charged matter.
When a field travels across to different media, the properties of the field change according to the various boundary conditions. These equations are derived from Maxwell's equations. The tangential components of the electric and magnetic fields as they relate on the boundary of two media are as follows[2]:
$\mathbf{E_{1}} = \mathbf{E_{2}}$
$\mathbf{H_{1}} = \mathbf{H_{2}}$ (current-free)
$\mathbf{D_{1}} = \mathbf{D_{2}}$ (charge-free)
$\mathbf{B_{1}} = \mathbf{B_{2}}$
The angle of refraction of an electric field between media is related to the permittivity $(\varepsilon)$ of each media:
$\frac{{\tan\theta_1}}{{\tan\theta_2}} = \frac{{\varepsilon_{r2}}}{{\varepsilon_{r1}}}$
The angle of refraction of an magnetic field between media is related to the permeability (μ) of each media:
$\frac{{\tan\theta_1}}{{\tan\theta_2}} = \frac{{\mu_{r2}}}{{\mu_{r1}}}$