system
Given the following post, respond as if you're commenting on Reddit:
human
Why does a photon have an electric field?

Or rather how does it have one?
gpt
I think discussing the reverse question is more illuminating: 

**Why does an electric field have photons?**  

From electromagnetic theory, we know the Lagrangian (an incredibly compact way to describe motion and energy in physics) is for chargeless situations,  

> ℒ = -¼F^(ij)F*_ij_*  

where 'i' and 'j' cycle through time, x, y z, and,  

> F^(ij) = (d/dx*_i_*)A^(j) - (d/dx*_j_*)A^(i)  

where we find the kernel of physics we are interested in. We want to know about A^j which is our electromagnetic four-potential from which flows the electric and magnetic fields. In short through a complicated relationship of how A^(j) changes, we get the equations of motion for the electromagnetic field. In classical electromagnetism, this is all find and dandy. We can figure out the electric and magnetic fields of wires and magnets. The properties of the four-potential yield us Maxwell's equations. From this we even get a classical wave equation that describes classical light! 

> (d/dx*_i_*)(d/dx^(i))A^(j) = 0

Light then becomes electromagnetic fields which do not have charges around them behaving in a way that obeys a wave equation. This light is continuous though, you can always have a little more or a little less or it, there are no restrictions the dynamics of this wave outside the wave equation.

However, something interesting happens when you try to *quantize* electrodynamics. The interesting thing is that to describe behavior, you're going to get terms which describe discreet changes in the electromagnetic field. Essentially, a restriction occurs that doesn't allow the electromagnetic field to behave completely arbitrarily. Another way to think of it is to picture the sound modes of an organ pipe.

These restricted objects which contribute to motion in electromagnetism are called photons. So that is why electromagnetic fields have photons.