Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Constrained Optimization and Physical Parameters

    How little energy can a field carry while retaining a prescribed charge? A numerical optimizer can find a stationary point, but the charge constraint, a continuous symmetry, and the units of its variables all affect what its stopping test means.

    We solve a finite complex-scalar example in two ways: with a Lagrange multiplier and by eliminating the momentum exactly. A completed square supplies a global lower bound independent of either algorithm. An excited stationary solution and a poorly scaled calculation show why a small optimizer residual needs interpretation.

    Preparation: Canonical fields in Hamiltonian field theory and the charge-generator sign in Noether's theorem. Derivatives here are analytic; automatic differentiation provides another way to evaluate the same Jacobians.

    Charge fixes a rotating minimum

    Consider a classical complex field on a periodic one-dimensional lattice. Write

    Φn=ϕn,1+iϕn,22,πn,A=ϕ˙n,A,J=(0−110).\Phi_n=\frac{\phi_{n,1}+i\phi_{n,2}}{\sqrt2}, \qquad \pi_{n,A}=\dot\phi_{n,A},\qquad J=\begin{pmatrix}0&-1\\1&0\end{pmatrix}.

    There are NN sites, spacing aa, and length L=NaL=Na. The momentum density π\pi obeys {ϕn,A,πk,B}=δnkδAB/a\{\phi_{n,A},\pi_{k,B}\}=\delta_{nk}\delta_{AB}/a; the canonical discrete momentum is aπa\pi. With m>0m>0, use

    H=a2∑n[∣πn∣2+∣ϕn+1−ϕna∣2+m2∣ϕn∣2],Q=a∑n(ϕn,2πn,1−ϕn,1πn,2)=−a∑nπn⋅Jϕn.\begin{aligned} H&=\frac a2\sum_n\left[ |\pi_n|^2+\left|\frac{\phi_{n+1}-\phi_n}{a}\right|^2 +m^2|\phi_n|^2\right],\\ Q&=a\sum_n(\phi_{n,2}\pi_{n,1}-\phi_{n,1}\pi_{n,2}) =-a\sum_n\pi_n\cdot J\phi_n. \end{aligned}

    This charge follows the site's current j0=i(Φ∗Φ˙−ΦΦ˙∗)j^0=i(\Phi^*\dot\Phi-\Phi\dot\Phi^*). Thus {Φ,Q}=−iΦ\{\Phi,Q\}=-i\Phi, and the phase transformation is δΦ=−α{Φ,Q}\delta\Phi=-\alpha\{\Phi,Q\}. Periodicity cancels the spatial flux, so {Q,H}=0\{Q,H\}=0. This is a genuine global U(1)U(1) charge. The integral of a single real field would not serve the same purpose.

    Fix Q=Q0>0Q=Q_0>0. Since JJ preserves the Euclidean norm in component space,

    H−mQ=a2∑n∣πn+mJϕn∣2+a2∑n∣ϕn+1−ϕna∣2≥0.\boxed{H-mQ= \frac a2\sum_n|\pi_n+mJ\phi_n|^2 +\frac a2\sum_n\left|\frac{\phi_{n+1}-\phi_n}{a}\right|^2\ge0.}

    Equality requires a spatially constant field and π=−mJϕ\pi=-mJ\phi. The charge then gives mL∣ϕ∣2=Q0mL|\phi|^2=Q_0. Therefore

    Hmin⁡=mQ0,ϕn=(A,0),πn=(0,−mA),A=Q0mL.H_{\min}=mQ_0,\qquad \phi_n=(A,0),\quad\pi_n=(0,-mA),\qquad A=\sqrt{\frac{Q_0}{mL}}.

    The minimizing initial data evolve as Φ(t)=Ae−imt/2\Phi(t)=A e^{-imt}/\sqrt2. The charge supports a rotating configuration, not a nonzero static field. This finite classical calculation does not compute the spectrum of an interacting quantum field theory.

    Multipliers, stationarity, and a global certificate

    Let K=−Δa+m2K=-\Delta_a+m^2, where −Δaϕn=(2ϕn−ϕn+1−ϕn−1)/a2-\Delta_a\phi_n=(2\phi_n-\phi_{n+1}-\phi_{n-1})/a^2. The constrained Lagrangian is

    L=H−ν(Q−Q0).\mathscr L=H-\nu(Q-Q_0).

    Its stationarity equations, after dividing field gradients by aa, are

    Kϕ−νJπ=0,π+νJϕ=0,Q=Q0.K\phi-\nu J\pi=0,\qquad \pi+\nu J\phi=0,\qquad Q=Q_0.

    Eliminating π\pi gives (K−ν2)ϕ=0(K-\nu^2)\phi=0. The minimum has ν=m\nu=m, but other eigenmodes also solve these equations. For k=2πr/Nk=2\pi r/N,

    ϕn=B(cos⁡kn,sin⁡kn),πn=−νrJϕn,\phi_n=B(\cos kn,\sin kn),\qquad \pi_n=-\nu_rJ\phi_n, νr=m2+4a2sin⁡2k2,B2=Q0νrL,H=νrQ0.\nu_r=\sqrt{m^2+\frac4{a^2}\sin^2\frac k2}, \qquad B^2=\frac{Q_0}{\nu_rL},\qquad H=\nu_rQ_0.

    A nonzero rr can therefore have exactly vanishing stationarity residual and still fail to minimize the energy. The nonlinear charge equality makes the feasible set nonconvex. General KKT conditions are not automatically sufficient here; the completed square is the independent global argument. The distinction between necessary stationarity and convex sufficiency is developed in Boyd and Vandenberghe, §5.5.3, pp.243–244 (PDF).

    There is also a simple dual certificate. Completing the square with ν\nu instead of mm gives

    H−νQ=a2∑n∣πn+νJϕn∣2+a2∑n∣∇aϕn∣2+a2(m2−ν2)∑n∣ϕn∣2.H-\nu Q= \frac a2\sum_n|\pi_n+\nu J\phi_n|^2 +\frac a2\sum_n|\nabla_a\phi_n|^2 +\frac a2(m^2-\nu^2)\sum_n|\phi_n|^2.

    Its unrestricted infimum is zero for ∣ν∣≤m|\nu|\le m and minus infinity otherwise. The dual lower bound is consequently νQ0\nu Q_0 on that interval. Its maximum, mQ0mQ_0, equals the exhibited feasible energy. This explicit equality establishes optimality without a general claim of strong duality for nonlinear constraints.

    Remove a flat direction only for the stated task

    Rotating both ϕ\phi and π\pi by a constant phase preserves HH and QQ. The phase direction (Jϕ,Jπ)(J\phi,J\pi) is a null vector of the Lagrangian Hessian at the minimum. An energy minimization cannot select one phase.

    For this phase-invariant objective, we choose the positive local representative with ϕ0,2=0\phi_{0,2}=0 and ϕ0,1>0\phi_{0,1}>0. All fixed-phase runs below return that positive sign. This coordinate choice requires ϕ0≠0\phi_0\ne0. It does not turn a physical global symmetry into a gauge redundancy, and would be inappropriate if the requested observable depended on that phase. In the full optimizer the phase condition is a linear equality. In the reduced optimizer we remove that component from the variables.

    The charge gradient and the phase gradient are independent at the chosen minimum. Restricting the Hessian of L\mathscr L to their common tangent space removes the phase null direction and tests curvature along feasible perturbations. This is a local diagnostic; the square still supplies the global proof.

    Eliminate the momentum instead

    For any nonzero ϕ\phi, put s=a∑n∣ϕn∣2s=a\sum_n|\phi_n|^2. Every momentum satisfying the charge constraint can be written

    π=−Q0sJϕ+v,a∑n(Jϕn)⋅vn=0.\pi=-\frac{Q_0}{s}J\phi+v, \qquad a\sum_n(J\phi_n)\cdot v_n=0.

    The two terms are orthogonal, so its kinetic energy is Q02/(2s)+∥v∥a2/2Q_0^2/(2s)+\|v\|_a^2/2. The minimum at fixed ϕ\phi has v=0v=0, leaving

    Ered(ϕ)=a2ϕTKϕ+Q022aϕTϕ,∇ϕEred=aKϕ−Q02aϕ(aϕTϕ)2.E_{\rm red}(\phi)=\frac a2\phi^TK\phi+ \frac{Q_0^2}{2a\phi^T\phi},\qquad \nabla_\phi E_{\rm red}=aK\phi- \frac{Q_0^2a\phi}{(a\phi^T\phi)^2}.

    Reconstructing the eliminated momentum enforces charge algebraically. The zero field is outside the reduced domain. This procedure minimizes over momentum exactly; it does not parameterize every feasible momentum or discard an uncontrolled dynamical term. It reduces the numerical problem from 32 variables with two equalities to 15 phase-fixed field components in the example below.

    The two formulations have different numerical failure modes. A multiplier solve can leave a small constraint residual; elimination can produce steep derivatives near a forbidden denominator. Neither formulation removes the need to inspect physical gradients and the objective.

    Scale the variables before interpreting a tolerance

    Introduce ϕ=Au\phi=A u and π=mAv\pi=mA v. Then

    HmQ0=12N∑n[∣vn∣2+∣un∣2+∣un+1−un∣2(ma)2],QQ0=1N∑n(un,2vn,1−un,1vn,2).\frac{H}{mQ_0}=\frac1{2N}\sum_n \left[|v_n|^2+|u_n|^2+ \frac{|u_{n+1}-u_n|^2}{(ma)^2}\right], \qquad \frac Q{Q_0}=\frac1N\sum_n(u_{n,2}v_{n,1}-u_{n,1}v_{n,2}).

    The target energy, charge, and constant-field components are now order one. A variable transformation x=Syx=Sy sends gradients to ST∇xHS^T\nabla_xH and Hessians to ST(∇x2H)SS^T(\nabla_x^2H)S. The optimizer tests derivatives in its own coordinates; a fixed numerical tolerance has no invariant meaning under arbitrary changes of SS.

    For the retained comparison define the normalized physical residual

    RKKT=∥S0(∇H−ν^∇Q)∥∞mQ0,S0=diag⁡(A1,mA1).R_{\rm KKT}=\frac{\|S_0(\nabla H-\widehat\nu\nabla Q)\|_\infty}{mQ_0}, \qquad S_0=\operatorname{diag}(A\mathbf1,mA\mathbf1).

    Here ν^=(∇Q⋅∇H)/∥∇Q∥2\widehat\nu=(\nabla Q\cdot\nabla H)/\|\nabla Q\|^2 is recomputed from the final fields. The companion also retains the solver's multiplier and coordinate residual. This independent residual tests the full physical stationarity equations, not only the phase-fixed coordinate problem.

    The retained optimization

    The calculation fixes N=8N=8, a=1/2a=1/2, m=1m=1, and Q0=1Q_0=1. Three deterministic, nonuniform starts are declared in charged_quadratic.py; the third also has a charge-orthogonal momentum component. No random initialization is selected for success.

    The multiplier method uses SciPy 1.13.1 trust-constr, exact first/second derivatives, dense QR constraint projections, a gradient/constraint tolerance 10−1010^{-10}, trust-radius tolerance 10−1210^{-12}, and 500 iterations. Elimination uses BFGS with its analytic gradient, tolerance 10−1010^{-10}, and the same iteration cap. SciPy distinguishes a gradient stop from a trust-radius stop and reports evaluation counts separately. SciPy 1.13.1, trust-constr, BFGS.

    FormulationStartStopIterationsRKKTR_{\rm KKT}
    Multiplier, normalized1Trust radius321.84×10−101.84\times10^{-10}
    Eliminated, normalized1Precision loss91.70×10−101.70\times10^{-10}
    Multiplier, normalized2Trust radius363.65×10−103.65\times10^{-10}
    Eliminated, normalized2Gradient121.71×10−121.71\times10^{-12}
    Multiplier, normalized3Trust radius402.08×10−92.08\times10^{-9}
    Eliminated, normalized3Gradient111.27×10−111.27\times10^{-11}
    Multiplier, poor coordinates1Coordinate gradient232.26×10−82.26\times10^{-8}
    Eliminated, poor coordinates1Precision loss599.20×10−119.20\times10^{-11}
    Multiplier, phase unfixed1Trust radius281.75×10−91.75\times10^{-9}

    The six normalized runs attain energy one within 5×10−165\times10^{-16} and charge within 3×10−163\times10^{-16}. That rounded energy agreement does not establish a 10−1610^{-16} accurate field or gradient: the energy is quadratic in small deviations near a stationary minimum. The positive completed-square residuals are evaluated directly, avoiding subtraction of two nearly equal energies.

    For the poor-coordinate multiplier control, (u,v)=diag⁡(10−31,1031)y(u,v)=\operatorname{diag}(10^{-3}\mathbf1,10^3\mathbf1)y. The reduced control alternates these factors among its field coordinates. Both use the same physical start as their normalized counterpart. The multiplier's coordinate residual is 2.60×10−112.60\times10^{-11}, but its physical residual is 2.26×10−82.26\times10^{-8}. Its charge misses by −4.23×10−14-4.23\times10^{-14}; the tiny energy below mQ0mQ_0 is therefore not a violation of the bound at its actual charge. The unfixed-phase run still reaches the minimum: a flat direction can cause ambiguity without necessarily preventing convergence.

    Final physical and optimizer-coordinate residuals for nine charge minimizations, with their retained termination conditions.

    The same physical objective is expressed in different coordinates. The physical residual uses S0S_0 in every run; the coordinate residual uses the optimizer's variables. The dashed line marks the requested 10−1010^{-10} tolerance, not a bound on every reported quantity. All stops, including precision loss, are retained.

    Independent controls give ∣{Q,H}∣=2.1×10−17|\{Q,H\}|=2.1\times10^{-17} and rotation/square-identity errors below 2.3×10−162.3\times10^{-16}. Directional differences check the supplied derivatives at several step sizes. The ground-state tangent Hessian has smallest eigenvalue 0.129580.12958 in the declared physical coordinates. The first helical stationary mode instead has energy 1.82842711.8284271 and tangent eigenvalue −0.4142136-0.4142136. Its small KKT residual is compatible with being a saddle.

    The pure model, driver, and retained output are charged_quadratic.py, charge_optimization.py, and charge-results.json in the optimization example directory. The finite problem has an exact analytic minimum; it does not test continuum extrapolation or global convergence of a general nonlinear optimizer.

    Summary

    A constraint is part of the physical problem, while a tolerance belongs to a chosen numerical representation. Multipliers expose stationarity and elimination can enforce a constraint exactly. The charge example also needs a phase representative and physically scaled residuals. Its global minimum follows from a completed square, which distinguishes a correct minimum from an excited KKT solution and a successful stop from an accurate gradient.

    Exercises

    1. Allow either sign of Q0Q_0. Find the minimum energy and the full range of dual multipliers for which inf⁡(H−νQ)\inf(H-\nu Q) is finite. What changes at Q0=0Q_0=0?
    Solution

    The square with arbitrary ν\nu contains (m2−ν2)∥ϕ∥a2/2(m^2-\nu^2)\|\phi\|_a^2/2. For ∣ν∣≤m|\nu|\le m every term is nonnegative, and the zero field gives infimum zero. If ∣ν∣>m|\nu|>m, a constant field with π=−νJϕ\pi=-\nu J\phi can be scaled to make the expression tend to minus infinity. The best dual lower bound is thus

    max⁡∣ν∣≤mνQ0=m∣Q0∣.\max_{|\nu|\le m}\nu Q_0=m|Q_0|.

    For nonzero charge, choose ν=msgn⁡Q0\nu=m\operatorname{sgn}Q_0, constant ∣ϕ∣2=∣Q0∣/(mL)|\phi|^2=|Q_0|/(mL), and π=−νJϕ\pi=-\nu J\phi. These fields realize both the charge and the bound. Negative charge reverses the rotation. At zero charge the minimizing field and momentum both vanish because m>0m>0. Its phase is undefined, so the nonzero-field phase chart and reduced formula with Q02/∥ϕ∥a2Q_0^2/\|\phi\|_a^2 should not be used to describe that endpoint.

    1. Show directly that a nonuniform Fourier stationary state is not a constrained minimum. Construct a charge-preserving path that initially leaves its energy stationary but then lowers it.
    Solution

    Let e0e_0 be a constant real-component field and ere_r the helical Fourier field, each normalized by ∥e∥a=1\|e\|_a=1, with ⟨e0,er⟩a=0\langle e_0,e_r\rangle_a=0. Their KK eigenvalues are m2m^2 and νr2>m2\nu_r^2>m^2. Define

    e(θ)=cos⁡θ er+sin⁡θ e0,κ(θ)=νr2cos⁡2θ+m2sin⁡2θ.e(\theta)=\cos\theta\,e_r+\sin\theta\,e_0, \qquad \kappa(\theta)=\nu_r^2\cos^2\theta+m^2\sin^2\theta.

    Choose ϕ=ρe(θ)\phi=\rho e(\theta) and π=−Q0Jϕ/ρ2\pi=-Q_0J\phi/\rho^2, so Q=Q0Q=Q_0 for every ρ>0\rho>0. Its energy is ρ2κ/2+Q02/(2ρ2)\rho^2\kappa/2+Q_0^2/(2\rho^2). Minimizing this radial variable gives ρ2=Q0/κ\rho^2=Q_0/\sqrt\kappa and

    H(θ)=Q0κ(θ)=Q0νr−Q0(νr2−m2)2νrθ2+O(θ4).H(\theta)=Q_0\sqrt{\kappa(\theta)} =Q_0\nu_r-\frac{Q_0(\nu_r^2-m^2)}{2\nu_r}\theta^2 +O(\theta^4).

    The first derivative vanishes at the Fourier state, but the second derivative is negative. This is a feasible descent direction, independent of any numerical Hessian eigensolver. With both component fields aligned along the first axis at site zero, it also lies in the chosen phase chart near θ=0\theta=0.

    References

    • Stephen Boyd and Lieven Vandenberghe, Convex Optimization (Cambridge University Press, 2004), author PDF, §5.5.3, pp.243–244, Eq.(5.49): KKT conditions and their convex sufficiency assumptions.
    • SciPy developers, SciPy 1.13.1 Manual, trust-constr and BFGS: coordinate tolerances, derivatives, evaluation counts and termination statuses used in the companion.

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.