% This is lecture no. 2 of MH3110/: Ordinary Differential Equations.

\chapter[The Geometric Interpretation]{The Geometric Interpretation of First Order DEs}%
\label{cha:the_geometric_interpretation_of_first_order_des}

\textbf{Direction fields} (or \textbf{slope fields}) are a tool to graphically obtain the solutions to a first order differential equation.
Consider for example $y^{\prime}=-2xy$.
The slope, $y^{\prime}(x)$ of the possible solutions $y(x)$ are determined once we know the values for $x$ and $y$.
If for example $x=1$ and $y=1$, then the slope of the solution $y(x)$ passing through the point $(1,-1)$ will be 2.

\bigbreak

If we were to plot the line segments at many point in the $xy$-plane, we would get an idea regarding the form of the DE's solutions by ``connecting the dots''.
The ``true'' solutions should not differ very much from those tangent line pieces.

\begin{figure}[h]
	\centering
	\begin{tikzpicture}[
		declare function={f(\x) = -2*\x*\y;}
		]
		\begin{axis}
			[
			axis equal image,
			view = {0}{90},
			xmin = -2.1, xmax = 2.1,
			ymin = -1.1, ymax = 1.1,
			domain = -2:2,
			y domain = -1:1,
			samples = 11,
			width = 0.8\textwidth,
			axis lines = none
			]
			\addplot3 [
			gray,
			quiver={
				u={1},v=f(x),
				scale arrows = 0.2,
				every arrow/.append style={
					-latex
				},
			}
			](x,y,0);
			\addplot[samples=31, smooth, thick, no markers]{exp(-x^2)};
			\addplot[samples=31, smooth, thick, no markers]{exp(-x^2 -1)};
			\addplot[samples=31, smooth, thick, no markers]{exp(-x^2 -8)};
			\addplot[samples=31, smooth, thick, no markers]{-exp(-x^2)};
			\addplot[samples=31, smooth, thick, no markers]{-exp(-x^2 -1)};
		\end{axis}
	\end{tikzpicture}
	\caption{Direction fields of $y^{\prime}=-2xy$, along with some solution curves following the direction fields.}
\end{figure}

\noindent
In general, we consider the first-order DE:
\[
\frac{\upd y}{\upd x} = f(x,y)
,\]
where $f(x,y)$ is a given function of $x$ and $y$, sometimes referred to as the \textbf{rate function, forcing term/function} or \textbf{source term}.
Suppose that $y=\phi(x)$ with $x$ on some interval $I$ is a solution of the equation above.
The graph $(x,\phi(x))$, $x\in I$, is called a \textbf{solution curve} or an \textbf{integral curve} of the DE.

\bigbreak
The geometric interpretation of the equation is that the slope of the tangent line $y^{\prime}=\phi^{\prime}(x)$ at any point $(x,y)$ on the solution curve $y=\phi(x)$ equals to the value $f(x,\phi(x))$ at that same point.
Hence, solving the equation is to find all curves whose slope at the point $(x,y)$ is given by the function $f(x,y)$.

\bigbreak
A direction field for the DE can be constructed by evaluating $f$ at each point of a grid, and then drawing a short line segment at each point whose slope is the value of $f$ at that point.
A directiong field drawn on a fairly fine grid gives a good picture of the overall behaviour of solutions of a DE.
