\chapter{Mathematical Modeling}
\section{Introduction}
The goal of mathematical modeling is to provide a mathematical description of the inter-relations between the system quantities as well as the relations between these quantities and external inputs. In general, the more accurate the mathematical model is, the more complex are the modeling equations. This means that during the modeling process we may be forced to finding a middle course between accuracy of the model and its complexity. Our goal is to generate the most accurate possible description of the given system while still being able to carry out the model analysis and computations in a reasonable amount of time. At first, we tend to make oversimplifying assumptions in order to obtain a very 
simple model. However, we should follow the Principle of Maximum Simplicity which states that "everything should be as simple as possible - but no simpler". After extracting 
some information about the system behavior based on this first, possibly crude model, it maybe desirable to construct a more accurate model. Thus, we try to create a mathematical description of a given physical process which incorporates realistic assumptions and physical constraints. We then extract information from this model and compare it with the 
experimental data. We perform this comparative study to determine the value of the obtained model. If the model appears to be inadequate for our needs, then it must be 
adjusted. The process of mathematical modeling is depicted in the schematic diagram in Figure~\ref{fig:mat_mod}.
\begin{figure}
\vspace{3.5in}
\hskip1.5in\special{bmp:c:/mybook/mat_mod.bmp x=4.6in y=3.5in}
\caption{Schematic diagram of mathematical modeling process.}
\label{fig:mat_mod}
\end{figure}
In the process of mathematical modeling we can use different types of equations and their combinations. In particular we can use the following types of equations:
\begin{enumerate}
\item algebraic
\item ordinary and partial differential
\item difference
\item integral
\item functional.
\end{enumerate}
In the following sections we discuss one of the methods of mathematical modeling using differential equations.

\section{Review of Work and Energy Concepts}
The purpose of this section is to review and reacquaint ourselves with some basic notions from physics like work, energy, etc. After a brief review of work and energy 
concepts, we derive the Lagrange equations of motion, and use them to devise mathematical models of a few simple dynamic systems.

Suppose we are given a particle of a constant mass m subjected to a force $\mb{\bm$F$}$. Then, by Newton's second law we have
\[
\mb{\bm$F$}=m \frac{d\mb{\bm$v$}}{dt}=m\mb{\bm$a$}.
\]		 
Here the force $\mb{\bm$F$}$ and the velocity $\mb{\bm$v$}$ are vectors. Therefore, they can be represented as
\[
\mb{\bm$F$}=\left[\begin{array}{ccc}
F_{x} & F_{y} & F_{z}
\end{array}\right]^{T}\quad \mb{and} \quad \mb{\bm$v$}=\left[\begin{array}{ccc}
v_{x} & v_{y} & v_{z}
\end{array}\right]^{T}.
\]
In view of this notation, we can represent the equation $\mb{\bm$F$}=m \frac{d\mb{\bm$v$}}{dt}$ as
\[
\left[\begin{array}{c}
F_{x}\\
F_{y}\\
F_{z}
\end{array}\right]=m\left[\begin{array}{c}
\frac{dv_{x}}{dt}\\
\frac{dv_{y}}{dt}\\
\frac{dv_{z}}{dt}
\end{array}\right].
\]
A single particle with no constraints is free to take up any position in space. This is the reason we need three coordinates to describe its position. In the case of a system of $p$ particles there are $3p$ degrees of freedom. In general, if there are constraints imposed on the particles, then the number of the degrees of freedom is
\[
n=3p - \mb{\em number of constraints}.
\]
For example, if the system consists of only one particle in space and if the particle is restricted to move along a line, then $n = 3 - 2 = 1$.

Suppose now that a force $\mb{\bm$F$}$ is acting on a particle at a point $A$ and the particle moves to a point $B$. The work $\delta W$ done by $\mb{\bm$F$}$ along infinitesimally small distance $\delta \mb{\bm$s$}$, is
\begin{eqnarray*}
\delta W &=& \mb{\bm$F$}^{T} \delta \mb{\bm$s$}\\
&=& \left[\begin{array}{ccc}
F_{x} & F_{y} & F_{z}
\end{array}\right] \left[\begin{array}{c}
\delta x\\
\delta y\\
\delta z
\end{array}\right]\\
&=& F_{x} \delta x + F_{y} \delta y + F_{z} \delta z.
\end{eqnarray*}
where $\delta \mb{\bm$s$}=\left[\begin{array}{ccc}
\delta x & \delta y & \delta z
\end{array} \right]^{T}$. Using the above equation we can find the work $W_{AB}$ done on the path from $A$ to $B$ by integrating the above equation. Thus
\[
W_{AB}=\int ^{B}_{A}\left(F_{x}dx + F_{y}dy + F_{z}dz \right).
\]
We now would like to establish a relation between work and kinetic energy. For this observe that
\[
\ddot{x}\,dx=\frac{d \dot{x}}{dt}dx=\dot{x} d\dot{x}.
\]
Using the above and Newton's second law we can express $W_{AB}$ in a different way as
\begin{eqnarray*}
W_{AB} &=& \int ^{B}_{A}\left(m\ddot{x}dx + m\ddot{y}dy + m\ddot{z}dz \right)\\
&=& \int^{B}_{A}m\left(\dot{x}d\dot{x} + \dot{y}d\dot{y} + \dot{z}d\dot{z} \right)\\
&=& m\left.\left(\frac{\dot{x}^2}{2}+\frac{\dot{y}^2}{2}+\frac{\dot{z}^2}{2} \right)\right\arrowvert^{B}_{A}\\
&=& m\left(\frac{\| \mb{\bm$v$}_{B} \|^2}{2}-\frac{\| \mb{\bm$v$}_{A} \|^2}{2} \right)\\
&=& \frac{m\| \mb{\bm$v$}_{B}\|^2}{2}-\frac{m\| \mb{\bm$v$}_{A}\|^2}{2}.
\end{eqnarray*}
where $\mb{\bm$v$}_{A}=\left[\begin{array}{ccc}
\dot{x}_{A} & \dot{y}_{A} & \dot{z}_{A}
\end{array}\right]^{T}$, and $\mb{\bm$v$}_{B}$ is defined in an analogous manner. Observing that $\frac{m\| \mb{\bm$v$}_{B}\|^2}{2}$ is the kinetic energy of the particle at the point $B$ and $\frac{m\| \mb{\bm$v$}_{A}\|^2}{2}$ is its kinetic energy at the point $A$, we obtain
\[
W_{AB}=K_{B}-K_{A}.
\]
The above relation can be used to define kinetic energy of a particle as the work required to change its velocity from some value $\mb{\bm$v$}_{A}$  to a final value $\mb{\bm$v$}_{B}$. The relation $W_{AB}=K_{B}-K_{A}=\Delta K$ is also known as the {\em work-energy theorem for a particle\/}.
We know that the work $\delta W$ done by the force $\mb{\bm$F$}$ is $\delta W=F_{x}\delta x + F_{y} \delta y + F_{z} \delta z$. On the other hand, this work is equal to the change in the kinetic energy. Therefore
\[
m\left( \ddot{x}\delta x +\ddot{y} \delta y + \ddot{z} \delta z\right)= F_{x}\delta x + F_{y} \delta y + F_{z} \delta z.
\]
The above equation is known as {\em D'Alembert's equation}. This equation will turn out to be very useful in later considerations.

If we have a system of particles acted upon by forces $\mb{\bm$F$}_1, \ldots, \mb{\bm$F$}_p$ and if each of the 
particles undergoes displacements $\delta \mb{\bm$s$}_1, \ldots, \delta \mb{\bm$s$}_p$, then the total work done by the forces is
\[
\delta W=\sum_{i=1}^{p}\left( F_{{x}_{i}} \delta x_{i} + F_{{y}_{i}} \delta y_{i} + F_{{z}_{i}} \delta z_{i} \right).
\]

\section{Lagrange Equations for a Single Particle}
We can use many different coordinate systems to describe a location of a particle in space. We will use the letter $q$ as a symbol for coordinate regardless of its nature. We 
refer to $q$ as a generalized coordinate. Thus, if
\begin{eqnarray*}
x &=& x(q_1,q_2,q_3),\\
y &=& y(q_1,q_2,q_3),\\
z &=& z(q_1,q_2,q_3),
\end{eqnarray*}
then 
\[
\dot{x}=\frac{\partial x}{\partial q_1}\dot{q}_1 + \frac{\partial x}{\partial q_2}\dot{q}_2 + \frac{\partial x}{\partial q_3}\dot{q}_3,
\]
etc. Assume now that a particle is confined to move on a surface. Therefore, to describe the location of the particle we need only two generalized coordinates. The position of the 
particle on a surface in a three dimensional space is then described as
\begin{eqnarray*}
x &=& x(q_1,q_2),\\
y &=& y(q_1,q_2),\\
z &=& z(q_1,q_2),
\end{eqnarray*}
and hence
\begin{eqnarray*}
\delta x &=& \frac{\partial x}{\partial q_1} \delta q_1 + \frac{\partial x}{\partial q_2} \delta q_2,\\
\delta y &=& \frac{\partial y}{\partial q_1} \delta q_1 + \frac{\partial y}{\partial q_2} \delta q_2,\\
\delta z &=& \frac{\partial z}{\partial q_1} \delta q_1 + \frac{\partial z}{\partial q_2} \delta q_2.
\end{eqnarray*}
Substituting the above relations into D'Alembert's equation we obtain
\begin{eqnarray*}
\delta W &=& m \left(\ddot{x}\frac{\partial x}{\partial q_1}+\ddot{y}\frac{\partial y}{\partial q_1}+\ddot{z}\frac{\partial z}{\partial q_1}\right) \delta q_1+m \left(\ddot{x}\frac{\partial x}{\partial q_2}+\ddot{y}\frac{\partial y}{\partial q_2}+\ddot{z}\frac{\partial z}{\partial q_2}\right)\delta q_2\\
&=& \left(F_{x}\frac{\partial x}{\partial q_1} + F_{y}\frac{\partial y}{\partial q_1} + F_{z}\frac{\partial z}{\partial q_1}\right)\delta q_1 + \left( F_{x}\frac{\partial x}{\partial q_2} + F_{y}\frac{\partial y}{\partial q_2} + F_{z}\frac{\partial z}{\partial q_2}\right)\delta q_2.
\end{eqnarray*}
Let
\[
F_{q_{1}}=F_{x}\frac{\partial x}{\partial q_1} + F_{y}\frac{\partial y}{\partial q_1} + F_{z}\frac{\partial z}{\partial q_1},
\]
and
\[
F_{q_{2}}=F_{x}\frac{\partial x}{\partial q_2} + F_{y}\frac{\partial y}{\partial q_2} + F_{z}\frac{\partial z}{\partial q_2}.
\]
Then, we can write
\[
\delta W=F_{q_1}\delta q_1 + F_{q_2}\delta q_2.
\]
To proceed further, note that
\[
\frac{d}{dt}\left(\dot{x}\frac{\partial x}{\partial q_1}\right)=\ddot{x}\frac{\partial x}{\partial q_1} + \dot{x}\frac{d}{dt}\left(\frac{\partial x}{\partial q_1} \right).
\]
Hence
\[
\ddot{x}\frac{\partial x}{\partial q_1}=\frac{d}{dt}\left(\dot{x}\frac{\partial x}{\partial q_1}\right)-\dot{x}\frac{d}{dt}\left(\frac{\partial x}{\partial q_1} \right).
\]
Consider now the following equation
\[
\dot{x}=\frac{\partial x}{\partial q_1}\dot{q}_1 + \frac{\partial x}{\partial q_2} \dot{q}_2.
\]
Differentiating the above partially with respect to $\dot{q}_1$, yields
\[
\frac{\partial \dot{x}}{\partial \dot{q}_1} = \frac{\partial x}{\partial q_1}.
\]
Finally, we will show that
\[
\frac{d}{dt} \left( \frac{\partial x}{\partial q_1} \right) = \frac{\partial \dot{x}}{\partial q_1}.
\]
Indeed, since $x=x(q_1,q_2)$ and the partial derivative ${\partial x}/{\partial q_1}$ is in general a function of $q_1$ and $q_2$, that is, ${\partial x}/{\partial q_1}=\phi\left( q_1,q_2 \right)$, we have
\[
\frac{d}{dt}\left(\frac{\partial x}{\partial q_1} \right) = \frac{\partial}{\partial q_1} \left(\frac{\partial x}{\partial q_1} \right) \dot{q}_1 + \frac{\partial}{\partial q_2} \left( \frac{\partial x}{\partial q_1} \right) \dot{q}_2.
\]
On the other hand
\[
\dot{x}=\frac{\partial x}{\partial q_1} \dot{q}_1 + \frac{\partial x}{\partial q_2}\dot{q}_2.
\]
Hence
\begin{eqnarray*}
\frac{\partial \dot{x}}{\partial q_1} &=& \frac{\partial}{\partial q_1} \left(\frac{\partial x}{\partial q_1} \right) \dot{q}_1 + \frac{\partial}{\partial q_1} \left( \frac{\partial x}{\partial q_2} \right) \dot{q}_2\\
&=& \frac{\partial}{\partial q_1} \left(\frac{\partial x}{\partial q_1} \right) \dot{q}_1 + \frac{\partial}{\partial q_2} \left( \frac{\partial x}{\partial q_1} \right) \dot{q}_2.
\end{eqnarray*}
Comparing the last two equations yields
\[
\frac{d}{dt} \left( \frac{\partial x}{\partial q_1} \right) = \frac{\partial \dot{x}}{\partial q_1}.
\]
We now use the above three equations to obtain the Lagrange 
equation of motion for a single particle. We first substitute $\frac{\partial \dot{x}}{\partial \dot{q}_1}=\frac{\partial x}{\partial q_1}$ and $\frac{d}{dt} \left( \frac{\partial x}{\partial q_1} \right) = \frac{\partial \dot{x}}{\partial q_1}$ into $\ddot{x}\frac{\partial x}{\partial q_1}=\frac{d}{dt}\left(\dot{x}\frac{\partial x}{\partial q_1}\right)-\dot{x}\frac{d}{dt}\left(\frac{\partial x}{\partial q_1} \right)$ to get
\[
\ddot{x}\frac{\partial x}{\partial q_1}=\frac{d}{dt}\left(\dot{x}\frac{\partial \dot{x}}{\partial \dot{q}_1}\right) -\dot{x}\frac{\partial \dot{x}}{\partial q_1}.
\]
Note that
\[
\frac{\partial}{\partial \dot{q}_1} \left(\frac{\dot{x}^2}{2} \right) = \dot{x} \frac{\partial \dot{x}}{\partial \dot{q}_1},
\]
and
\[
\frac{\partial}{\partial q_1} \left(\frac{\dot{x}^2}{2} \right) = \dot{x} \frac{\partial \dot{x}}{\partial q_1}.
\]
Hence
\[
\ddot{x}\frac{\partial x}{\partial q_1} = \frac{d}{dt}\left( \frac{\partial \left( \frac{\dot{x}^2}{2} \right)}{\partial \dot{q}_1} \right) - \frac{\partial \left( \frac{\dot{x}^2}{2} \right)}{\partial q_1}.
\] 
We can obtain similar expressions for $y$ and $z$. Taking this into account we get
\begin{eqnarray*}
F_{q_1} \delta q_1 &=& \left( \frac{d}{dt} \left(\frac{\partial}{\partial \dot{q}_1} \frac{m\left(\dot{x}^2 + \dot{y}^2 + \dot{z}^2 \right)}{2}\right) - \frac{\partial}{\partial q_1} \frac{m \left( \dot{x}^2 + \dot{y}^2 + \dot{z}^2 \right)}{2}  \right) \delta q_1\\
&=& \left( F_{x} \frac{\partial x}{\partial q_1} + F_{y} \frac{\partial y}{\partial q_1}+F_{z} \frac{\partial z}{\partial q_1}\right) \delta q_1.
\end{eqnarray*}
Let $K=\frac{1}{2}m \left(\dot{x}^2 + \dot{y}^2 + \dot{z}^2 \right)$ denote the kinetic energy of the particle. Then, we have
\[
\frac{d}{dt} \left( \frac{\partial K}{\partial \dot{q}_1} \right) - \frac{\partial K}{\partial q_1} = F_{q_1}.
\]
This equation is called the {\em Lagrange equation of motion} for the $q_1$ coordinate. Using the same arguments as above, we can derive the Lagrange equation of motion for the $q_2$ coordinate. In general there are as many the Lagrange equations of motion as there are degrees of freedom of the particle.

Recall that the expression $\delta W=F_{x} \delta x + F_{y} \delta y + F_{z} \delta z$ is a work done by a force $\mb{\bm$F$}=\left[\begin{array}{ccc}
F_{x} & F_{y} & F_{z}
\end{array} \right]^T$ for a general displacement $\delta \mb{\bm$s$}=\left[\begin{array}{ccc}
\delta x & \delta y & \delta z
\end{array} \right]^T$ . In terms of generalized coordinates and when, say, $\delta q_2 =0$,  we have
\begin{eqnarray*}
\delta W &=& \left( F_{x} \frac{\partial x}{\partial q_1} + F_{y} \frac{\partial y}{\partial q_1}+F_{z} \frac{\partial z}{\partial q_1}\right) \delta q_1\\
&=& F_{q_1} \delta q_1\\
&=& \delta W_{q_1}.
\end{eqnarray*}
In general, a generalized force $F_{q_{r}}$ is of such nature that the product $F_{q_{r}} \delta q_{r}$ is the work 
done by driving forces when $q_{r}$  alone is changed by $\delta q_{r}$. We mention that a generalized force does not have to be a force in the usual sense. For example, if $q_{r}$ is an angle, then $F_{q_{r}}$ must be a torque in order that $F_{q_{r}} \delta q_{r}$ be work.

We now derive a more general version of the Lagrange equations of motion for a single particle. In our derivation we will need notions of {\em conservative\/} and {\em nonconservative\/} forces that we discuss next. First recall that we interpret the kinetic energy of a particle as its ability to do work by virtue of its motion. This motion is the result of forces acting upon the particle. We distinguish between two types of forces: conservative and nonconservative. A force is conservative if the work done by the force on a particle that moves through any round trip is zero. In other words, a force is conservative if the work done by it on a particle that moves between two points depends only on these points and not on the path followed. A force is nonconservative if the work done by the force on a particle that moves through any round trip is not zero. Thus a force is nonconservative if the work done by that force on a particle that moves between two points depends also on the path taken between these points. Having described conservative and nonconservative forces we now review the notion of {\em potential energy\/} or what is the same {\em energy of configuration}. Recall that if the kinetic energy $K$ of a particle changes by $\Delta K$, then the potential energy U must change by an equal but opposite amount so that the sum 
of the two changes is zero, that is,
\[
\Delta K + \Delta U = 0.
\]
This is equivalent to saying that any change in the kinetic energy of the particle is compensated for by an equal but opposite change in the potential energy U of the particle 
so that their sum remains constant, that is,
\[
K + U = \mb{constant}.
\]
We prove the above relation rigorously after discussing other relevant terms. The potential energy of a particle represents a form of stored energy that can be recovered and converted into the kinetic energy. If we now use the work-energy theorem and the equation $\Delta K + \Delta U =0$, then we obtain
\[
W=\Delta K = -\Delta U.
\]
The work done by a conservative force depends only on the starting and the end points of motion and not on the path followed between them. Therefore, for motion in one 
dimension we have
\[
\Delta U =-W =- \int_{x_0}^{x}F(s)ds.
\]
The potential energy of the particle depends on its position only. Hence, the total mechanical energy E stored by the particle is
\[
E=\frac{1}{2}mv^2 + U(x).
\]
The above equation is referred to as the {\em law of conservation of mechanical energy for conservative forces}. Assume now that the particle moves from a point $A$ where its position is $x_0$ and its velocity $v_0$ to a point $B$ where its position is $x$ and its velocity is $v$. The total 
mechanical energy $E$ must be the same at each point when the forces acting on the particle are conservative and the law of conservation of energy will take the form
\[
\frac{1}{2}mv^2 + U(x) = \frac{1}{2}mv_0^2 + U(x_0).
\]
This equation can be rewritten as
\[
U(x)-U(x_0)=-\left(\frac{1}{2}mv^2 - \frac{1}{2}mv_0^2 \right),
\]
or in the form
\[
\Delta U = -\int_{x_0}^{x} F(s)ds.
\]
We thus can write
\[
F(x)=-\frac{dU(x)}{dx}.
\]
A generalization of the equation $\Delta U = -\int_{x_0}^{x} F(s)ds$  to motion in three dimensions yields
\[
\Delta U = -\int_{x_0}^{x} F_{x}ds -\int_{y_0}^{y} F_{y}ds -\int_{z_0}^{z} F_{z}ds.
\]
Hence, a generalization of the equation $F(x)=-\frac{dU(s)}{dx}$ to motion in three dimensions is
\begin{eqnarray*}
\mb{\bm$F$}\left( \mb{\bm$x$} \right) &=& -\left[\begin{array}{ccc}
\frac{\partial U}{\partial x} & \frac{\partial U}{\partial y} & \frac{\partial U}{\partial z}
\end{array}\right]^{T}\\
&=& -\nabla U \left( \mb{\bm$x$} \right),
\end{eqnarray*}
where $\mb{\bm$x$}= \left[\begin{array}{ccc}
x & y & z
\end{array}\right]^{T}$.
We now formally state and prove the law of conservation of energy.
\begin{thm}
Given conservative vector field $\b F$, that is, $\b F=-\nabla U$, where $U$ is the potential energy. Assume that a particle of mass $m$, satisfying Newton's law, moves on a differentiable curve $\b C$. Then, the sum of the potential energy and kinetic energy is constant.
\end{thm}
{\bf Proof}\quad Let $\b C(t)$ be a differentiable curve along which a particle of mass $m$ moves. Hence
\[
\b F(\b C(t))=m\ddot{\b C}(t).
\]
We now prove that
\[
U(\b C(t))+\frac{1}{2}m\left\|\dot{\b C}(t)\right\|^2=\mb{constant}.
\]
We differentiate the above sum with respect to time and show that the time derivative is zero, hence the sum of the energies is constant. By the chain rule we have
\[
\frac{d}{dt}\left(U(\b C(t))+\frac{1}{2}m\left\|\dot{\b C}(t)\right\|^2 \right)=\nabla ^T U(\b C(t))\dot{\b C}(t)+m\dot{\b C}^T(t)\ddot{\b C}(t).
\]
By Newton's law and the assumption that $\b F$ is a conservative vector field we have
\[
m\ddot{\b C}(t)=\b F(\b C(t))=-\nabla U(\b C(t)).
\]
Hence
\begin{eqnarray*}
\nabla ^T U(\b C(t))\dot{\b C}(t)+m\dot{\b C}^T(t)\ddot{\b C}(t) &=& \nabla ^T U(\b C(t))\dot{\b C}(t)+\dot{\b C}^T(t)\left(m \ddot{\b C}(t)\right)\\
&=&\nabla ^T U(\b C(t))\dot{\b C}(t)-\dot{\b C}^T(t)\nabla U(\b C(t))\\
&=&0,
\end{eqnarray*}
which proves the theorem.\\
\hspace*{5.5in}$\Box$

We now formally prove the property of a conservative vector field that the work done by it on a particle that moves between two points depends only on these points and not on the path followed. Indeed, the work done against the conservative force filed $\b F$ along a curve $\b C$ between points $\b C(t_1)$ and $\b C(t_2)$ is
\[
\int_{t_1}^{t_2}\b F^T(\b C(t))\dot{\b C}(t)dt.
\]
By assumption $\b F$ is a conservative vector field. Hence,
\[
\b F=-\nabla U.
\]
Combining the above yields
\[
\int_{t_1}^{t_2}\b F^T(\b C(t))\dot{\b C}(t)dt=-\int_{t_1}^{t_2}\nabla^T U(\b C(t))\dot{\b C}(t)dt.
\]
Using the chain rule we represent the expression inside the integral on the right hand side as
\[
\nabla^T U(\b C(t))\dot{\b C}(t)=\frac{d U(\b C(t))}{dt}.
\]
Using the above and the fundamental theorem of calculus we obtain
\begin{eqnarray*}
\int_{t_1}^{t_2}\nabla^T U(\b C(t))\dot{\b C}(t)dt&=&\int_{t_1}^{t_2}\frac{d U(\b C(t))}{dt} dt\\
&=& U(\b C(t_2))-U(\b C(t_1)).
\end{eqnarray*}
Hence, the work done against the conservative vector field $\b F$ is
\[
\int_{t_1}^{t_2}\b F^T(\b C(t))\dot{\b C}(t)dt=U(\b C(t_1))-U(\b C(t_2)),
\]
which does not depend on the path followed.

Let us now suppose that in addition to the conservative forces, a single nonconservative force due to friction acts on the particle. Denote by $\sum W_{c}$ the sum of the work done by the conservative forces, and by $W_{f}$ the work done by friction. We then have
\[
W_{f}+\sum W_{c}= \Delta K.
\]
Thus, if a non conservative force, like friction, acts on a particle, then the total mechanical energy is not constant, but changes by the amount of work done by a nonconservative 
force according to the relation $W_{f}+\sum W_{c}= \Delta K$. Let us now denote by $E$ the final mechanical energy of the particle and by $E_0$ its initial mechanical energy. Then, we can write
\[
E-E_0=\Delta E = W_{f}.
\]
The work done by friction, the non conservative force in our mental experiment, is always negative. Hence, the final mechanical energy $E$ is less than the initial mechanical energy. The ``lost'' mechanical energy is transformed into {\em internal energy\/} $U_{int}$. In other words, the loss of mechanical energy equals the gain in internal energy and we write
\[
\Delta E + U_{int} = 0.
\]
In general, we have
\[
\Delta K + \sum \Delta U + U_{int} + \left(\mb{change in other forms of energy}\right)=0.
\]
This means that the total energy, kinetic plus potential plus internal plus all other forms of energy, does not change. This is the {\em principle of the conservation of energy}. To proceed further, observe that any generalized force $F_{q_i}$ acting on our particle can be expressed as
\[
F_{q_i}=F_{x}\frac{\partial x}{\partial q_i}+F_{y}\frac{\partial y}{\partial q_i} + F_{z}\frac{\partial z}{\partial q_i}.
\]
Assuming the forces are conservative we get
\[
F_{q_i}=-\left( \frac{\partial U}{\partial x}\frac{\partial x}{\partial q_i} + \frac{\partial U}{\partial y}\frac{\partial y}{\partial q_i} + \frac{\partial U}{\partial z}\frac{\partial z}{\partial q_i}\right).
\]
We thus have
\[
F_{q_i}=-\frac{\partial U}{\partial q_i}.
\]
Therefore, the Lagrange equations of motion for a single particle for conservative forces can be represented as
\[
\frac{d}{dt}\left(\frac{\partial K}{\partial \dot{q}_i} \right) - \frac{\partial K}{\partial q_i}=-\frac{\partial U}{\partial q_i}.
\]
We can rearrange the above equations as
\[
\frac{d}{dt}\left(\frac{\partial K}{\partial \dot{q}_i} \right) - \frac{\partial}{\partial q_i}\left( K-U \right)=0.
\]
We now introduce the {\em Lagrangian function\/} $L$, defined as
\[
L=K-U.
\]
Note that since $U$ is not a function of $\dot{q}_i$, we have 
\[
\frac{\partial K}{\partial \dot{q}_i}=\frac{\partial L}{\partial \dot{q}_i}.
\]
Taking the above into account, we can represent the Lagrange equations of motion for conservative forces as
\[
\frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}_i} \right) - \frac{\partial L}{\partial q_i} = 0.
\]
If some of the forces acting on the particle are nonconservative, the Lagrange equations of motion for our particle will take the form
\[
\frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}_i} \right) - \frac{\partial L}{\partial q_i} = \tilde{F}_{q_i},
\]
where $\tilde{F}_{q_i}$ are non conservative forces acting on the particle.
\begin{example} \rm
Consider the simple pendulum shown in Figure~\ref{fig:sim_ped}.
\vspace*{0.1in}
\begin{figure}
\vspace{3.5in}
\hskip1in\special{bmp:c:/mybook/sim_ped.bmp x=4.6in y=3.5in}
\caption{A simple pendulum.}
\label{fig:sim_ped}
\end{figure} 
The simple pendulum is an idealized body consisting of a point mass $M$, suspended by a weightless inextensible cord of length $l$. Its kinetic energy is
\[
K=\frac{1}{2}Ml^2\dot{\theta}^2.
\]
We assume that the potential energy of the pendulum is zero when the pendulum is at rest. Hence, its potential energy is
\[
U=Mgl ( 1 - \cos \theta ),
\]
where $g$ is the acceleration due to gravity. We assume $g=10\,m/s^2$. The Lagrangian function is
\begin{eqnarray*}
L &=& K-U\\
&=& \frac{1}{2}Ml^2 \dot{\theta}^2 - Mgl ( 1 - \cos \theta )\\
&=& 6 \dot{\theta}^2 - 60(1 - \cos \theta ).
\end{eqnarray*}
The Lagrange equation describing the pendulum motion is
\[
\frac{d}{dt} \left( \frac{\partial L}{\partial \dot{\theta}} \right) - \frac{\partial L}{\partial \theta} = 0.
\]
In our example the above equation evaluates to
\[
12 \ddot{\theta}+ 60 \sin \theta =0,
\]
or equivalently
\[
\ddot{\theta}=-5 \sin \theta.
\]
\end{example}


