Magnetic field
A magnetic field is a vector field that describes the magnetic influence of electrical currents and magnetized materials. In everyday life, the effects of magnetic fields are often seen in permanent magnets, which pull on magnetic materials (such as iron) and attract or repel other magnets. Magnetic fields surround and are created by magnetized material and by moving electric charges (electric currents) such as those used in electromagnets. Magnetic fields exert forces on nearby moving electrical charges and torques on nearby magnets. In addition, a magnetic field that varies with location exerts a force on magnetic materials. Both the strength and direction of a magnetic field varies with location. As such, it is an example of a vector field.
Earth's magnetic field
The mechanism by which the Earth generates a magnetic field is known as a dynamo. The magnetic field is generated by a feedback loop: current loops generate magnetic fields (Ampère's circuital law); a changing magnetic field generates an electric field (Faraday's law); and the electric and magnetic fields exert a force on the charges that are flowing in currents (the Lorentz force). These effects can be combined in a partial differential equation for the magnetic field called the "magnetic induction equation",