The most general form of Maxwell's theorem:
$ f:R^N \to [0 , \infty] $ , $ f $ is measurable
$ x, y,p, q \in R^N $
Solve $ f (x) + f (y) = f (p) + f ( q) $, under the conditions :$ x+y=p+q, x^2+y^2=p^2+q^2$. Where $ x^2$ is the norm of $ x $
$\psi (x, y)=f (x) f (y) $
$ \psi (x, y) $ is constant whenever $ x+y, x^2+y^2$ is constant. Therefore $\psi (x, y)= G (x+y, x^2+y^2) $
$f (x, x^2) f (y, y^2)= G (x+y, x^2+y^2) $
$f (u, v^2) f (w,z^2)= G (u+w, v^2+z^2) $
If there is $ u,v$ such that $ f (u, v^2) =0$ implies $ G (u+w, v^2+z^2)=0$ . Since $ w,z $ are arbitrary, it implies $ G(a,b^2)=0$ for all $ a, b \in R^N $ which implies $ f (n, m^2) =0$ for all $ n,m \in R^N $
Since $\int f dx^N > 0$, base on the result above $ f> 0$
$\varphi (x, x^2)=log (f (x, x^2)) $
$\varphi(x, x^2)+\varphi(y, y^2)=F (x+y, x^2+y^2)$
So $\varphi (x, x^2)+\varphi(y, y^2)=F(x+y,x^2+y^2)$
$$\varphi_1(x, x^2)=\varphi(x, x^2)-\varphi(0,0)$$
$$\varphi_1(y, y^2)=\varphi(y, y^2)-\varphi(0,0)$$
$F_1(x+y,x^2+y^2)=F(x+y,x^2+y^2)-F(0,0)$
so that $\varphi_1(0,0)=F_1(0,0)=0$
$$\varphi_1(x, x^2) +\varphi_1(y, y^2)=F_1(x+y,x^2+y^2)$$
plug $y=0$ into the equation above and get $\varphi_1(x, x^2)=F_1(x,x^2)$ and similarly $\varphi_1(y, y^2)=F_1(y,y^2)$
Therefore $\varphi_1(x,x^2) +\varphi_1(y,y^2)=\varphi_1(x+y,x^2+y^2)$
$\varphi_1(u,v^2) =\varphi_1(u,0)+\varphi_1(0,v^2)$
let $f(u)=\varphi_1(u,0)$ , and $g(v)=\varphi_1(0,v^2)$
$f(a+b)=f(a)+f(b)$
$g(a+b)=g(a)+g(b)$
By solution of Cauchy functional equation for measurable functions: $f(u)=b\cdot u$ $\quad$ $g(v)=av^2$ $\quad$ and $\varphi_1(x,x^2)=ax^2+b\cdot x$ $a\cdot e \quad$ $\varphi(x,x^2)=\varphi_1(x,x^2)+\varphi(0,0)$ $a\cdot e$ set $\varphi(0,0)=c$
$\varphi(x,x^2)=ax^2+b\cdot x+c$ $\quad$
$f(x) = e^{ax^2+bx+c}=Ae^{ax^2+bx}$ $\quad a\cdot e$ where $A=e^c$