The Grad–Shafranov equation (H. Grad and H. Rubin (1958); Vitalii Dmitrievich Shafranov (1966)) is the equilibrium equation in ideal magnetohydrodynamics (MHD) for a two dimensional plasma, for example the axisymmetric toroidal plasma in a tokamak. This equation takes the same form as the Hicks equation from fluid dynamics. This equation is a two-dimensional, nonlinear, elliptic partial differential equation obtained from the reduction of the ideal MHD equations to two dimensions, often for the case of toroidal axisymmetry (the case relevant in a tokamak). Taking as the cylindrical coordinates, the flux function is governed by the equation, where is the magnetic permeability, is the pressure, and the magnetic field and current are, respectively, given by The nature of the equilibrium, whether it be a tokamak, reversed field pinch, etc. is largely determined by the choices of the two functions and as well as the boundary conditions. Derivation (in Cartesian coordinates) In the following, it is assumed that the system is 2-dimensional with as the invariant axis, i.e. produces 0 for any quantity. Then the magnetic field can be written in cartesian coordinates as or more compactly, where is the vector potential for the in-plane (x and y components) magnetic field. Note that based on this form for B we can see that A is constant along any given magnetic field line, since is everywhere perpendicular to B. (Also note that -A is the flux function mentioned above.) Two dimensional, stationary, magnetic structures are described by the balance of pressure forces and magnetic forces, i.e.: where p is the plasma pressure and j is the electric current. It is known that p is a constant along any field line, (again since is everywhere perpendicular to B). Additionally, the two-dimensional assumption () means that the z- component of the left hand side must be zero, so the z-component of the magnetic force on the right hand side must also be zero. This means that , i.e. is parallel to . The right hand side of the previous equation can be considered in two parts: where the subscript denotes the component in the plane perpendicular to the -axis. The component of the current in the above equation can be written in terms of the one-dimensional vector potential as The in plane field is and using Maxwell–Ampère's equation, the in plane current is given by In order for this vector to be parallel to as