Efficient algorithms often arise from the specifities of an underlying application domain, perhaps none more so than those inspired from physics. Classical physics can be derived from a remarkably small set of experimentally verified postulates.
The least action principle asserts that a physical system can be described by a function of the system generalized coordinates and velocities , known as the Lagrangian, itself the difference of the system's kinetic and potential energy . The time evolution of the system is known as the system's trajectory , and of all possible trajectories consistent with system constraints the trajectory actually followed by the system from initial time to final time minimizes a functional known as the action
Example. However complex a physical system might be, application of the least action principle follows the procedure exemplified here for a simple mass-spring system. A point mass attached to a spring of stiffness is at distance away from the equilibrium position . For constant , this harmonic oscillator motion is described by the differential system
A state of this system is given by the values for position and velocity , and the above equations specify the time evolution of the system. Denoting the velocity as , , and eliminating gives the familiar
(1) |
The same equation also results from the minimization of the action of the Lagrangian
(2) |
with , . The minimization is performed over all trajectories with the same end-point values at . Let the operator denote a small change in a trajectory. Since all trajectories have the same endpoints . The change in the action is
Consider changes in overall trajectory to be independent of time such that the and operators commute, and apply integration by parts
For to be at a minimum the change in the action must be stationary ,
For the above to be valid for all the equation
One class of constraints are the conservation laws, the experimental observation that certain quantities remain constant during the system's evolution. Classical mechanics identifies three conserved quantities: mass, momentum, and energy. It is a matter of personal preference to also consider conservation of angular momentum as fundamental or as a consequence of conservation of linear momentum. Classical electrodynamics adds conservation of electric charge, while quantum mechanics also defines conservation of certain microscopic quantities known as quantum numbers such as the baryon or lepton numbers.
Other constraints often refer to allowed spatial positions and are known generically as geometric constraints. Note that this is an idealization: in reality some other physical system is interacting with the one being considered and it is assumed that the system is so much larger that its position does not change. Such idealization or modeling assumptions are often encountered. As another important example, the system may exhibit energy dissipation, such as the decrease of an object's momentum due to friction. Energy is indeed lost from system to the surrounding medium , but the overall energy of the combined system is conserved.
Scientific computation uses many concepts and terms from physics, such as the characterization of a numerical scheme for differential equations as being “conservative”, in the sense of maintaining the conserved physical quantities. Also, a remarkably large number of efficient algorithms arise from the desire to mimic physical properties. Conservation laws can be stated for a small enough spatial domain that it can be considered to be infinitesimal in the sense of calculus. In this case differential conservation laws are obtained. Alternatively, consideration of a finite-sized spatial domain leads to integral formulation of the conservation laws. In a large class of physical systems of current research interest models are constructed in which the evolution of the system depends on the history of interactions with the surrounding medium . Such systems are described by integro-differential laws, elegantly expressed through fractional derivatives.
(3) |
is some constant. Equation (3) is self-evident but not particularly illuminating – of course the amount of money is constant if nothing goes in or out! Similar physics statements such as “the total mass-energy of the universe is constant” are again not terribly useful, though one should note this particular statement is not obviously true. Things get more interesting when we consider a more realistic scenario in which the system is not isolated. People might be coming and going from building and some might actually have money in their pockets. In more leisurely economic times, one might be interested just in the amount of money in the building at the end of the day. Just a bit of thought leads to
where is the amount of money at the end of day , that from the previous day and the difference between money received and that payed in the building during day
As economic activity picks up and we take building to mean “bank” it becomes important to keep track of the money at all times, not just at the end of the day. It then makes sense to think of the rate at which money is moving in or out of the building so we can not only track the amount of currency at any given time, but also be able to make future predictions. Instead of separate receipts and payments , use a single quantity to denote the amount of money leaving or entering building during time interval with the understanding that positive values of represent incomes and negative ones expenditures. Such understandings go by the name of sign conventions. They're not especially meaningful but it aids communication if a single convention is adopted. The amount of euros in the building then changes in accordance to
(4) |
and is known as a flux, the Latin term for flow.
While (4) is a good approximation for small intervals, errors arise when is large since economic acitvity might change from hour to hour. Better accounting is obtained by considering as defined at any given time , such that is the instantaneous flux of euros at time . The fundamental theorem of calculus then states
(5) |
with the same significance as (4).
In a large bank one keeps track of the amount of money in individual rooms and the inflows and outflows through individual doors. A room or door can be identified by its spatial position , but refers to a single point and physical currency occupies some space. The conceptual difficulty is overcome by introducing a fictitious density of currency at time denoted by . The only real meaning associated with this density is that the sum of all values of in some volume is the amount of currency in that volume
(6) |
On afterthought, the same sort of question should have arisen when was defined at one instant in time. Ingrained psychological perspectives make more plausible, but were we to live our lives such that quantum fluctuations are observable, would be much more questionable.
By an analogous procedure, define as the instantaneous flux density of euros in a small region around . This flux is a vector quantity to distinguish fluxes along different spatial directions. The flux density along direction is given by . Consider as the inward pointing unit vector normal to the surface that bounds the bank. The total flux is again obtained by integrating flux densities
(7) |
Gathering the above leads to re-expressing (4) or (5) gives
(8) |
Using (6) leads to the statement,
There are special cases in which additional events affecting the balance of can occur. When is a reserve bank money might be (legally) printed and destroyed in the building. Again by analogy with fluid dynamics, such events are said to be sources of within , much like a underground spring is a source of surface water. Let be the total sources at time . As before, might actually be obtained by summing over several sources placed in a number of positions, for instance the separate printing presses and furnaces that exist in . It is useful to introduce a spatial density of sources . The conservation statement now becomes
(9) |
The above encompasses all physical conservation laws, and is quite straightforward in interpretation:
change in Euros in = net Euros coming in or going out of + net Euros produced or destroyed in .
It should be emphasized that the above statement has true physical meaning and is referred to as an integral formulation of a conservation law. The key term is “integral” and refers to the integration over some spatial domain.
(10) |
The minus assign arises from the convention of an inward pointing normal. Applying (10) to (9) leads to
(11) |
There was nothing special about the shape of the building or the length of the time interval we used in deriving (11), hence the equality should hold for infinitesimal domains
(12) |
where, as is customary, the dependence of on space and time is understood but not written out explicitly. Equation (12) is known as the local or differential form of the conservation law for .
(13) |
The correspondence with (12) is given by , , hence the statement: “external forces are sources of momentum”. Instead of a PDE, the lack of internal structure has led to an ODE.
(14) |
Choosing the origin such that and , the simplest truncation is
(15) |
and the form of (12) is
(16) |
In this approximation is a constant giving
(17) |
known as the constant velocity advection equation. Its one-dimensional form is the basis of much development in numerical methods for PDE's
(18) |
(19) |
and this leads to
(20) |
If there are no sources and is a constant we have
(21) |
the heat or diffusion equation.
(22) |
known as the advection-diffusion equation, and is a linear PDE. If sources exist the above becomes
(23) |
or for constant advection velocity
(24) |
It is often the case that the flux depends on the conserved quantity itself, , in which case (22) becomes a non-linear PDE.
If the infinitesimal volume contains sources the Poisson equation
is obtained.
with a positive constant to avoid unphysical exponential growth. The spatial part of the solution statisfies the Helmholtz equation
with . The above is interpreted as an eigenproblem for the Laplacian operator .
The above special forms of differential conservation laws play an important role in scientific computation. Numerical techniques have been developed to capture the underlying physical behavior expressed in say the diffusion equation or the Helmholtz equation. These equations were first studied within physics, but they reflect universal behavior. Consider the Black-Scholes financial model for the price of an option on an asset
with the standard deviation of stock market returns and the annualized risk-free interest rate. The terminology might be totally different, but the same patterns emerge and the Black Scholes model can be interpreted as an advection diffusion equation with non-constant advection velocity , negative diffusion coefficient and source term . The similarity to the physics advection and diffusion equations arises from the same type of modeling assumptions relating fluxes to state variables.