This is a tutorial made solely for the purpose of education and it was designed for students taking Applied Math 0330. It is primarily for students who have very little experience or have never used Mathematica before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel.

Finally, the commands in this tutorial are all written in bold black font, while Mathematica output is in normal font. This means that you can copy and paste all commands into Mathematica, change the parameters and run them. You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the second course APMA0330
Return to Mathematica tutorial for the first course APMA0340
Return to the main page for the course APMA0340
Return to the main page for the course APMA0330
Return to Part IV of the course APMA0330

Differential Equations of higher order

Recall from calculus that derivatives of functions u(x) and y(t) are denoted as \( u'(x) \quad \mbox{or} \quad {\text d}u /{\text d}x \) and \( y' (t) = {\text d}y/ {\text d}t \quad \mbox{or} \quad \dot{y} , \) respectively. Newton's dot notation (\( \dot{y} \) ) is usually used to represent the derivative with respect to time. The notation x or t stands for the independent variable and will be widely used. Higher order derivatives have similar notation; for example, f'' or \( {\text d}^2 f/{\text d}x^2 \) denotes the second derivatives.

A second order differential equation in the normal form is as follows: \begin{equation} \label{E41.1} \frac{{\text d}^2 y}{{\text d} x^2} = F\left( x,y,\frac{{\text d}y}{{\text d}x} \right) \qquad \mbox{or} \qquad y'' = F\left( x,y,y' \right) , \end{equation} where F(x,y,p) is some given function of three variables. If the function F(x,y,p) is linear in variables y and p (that is, \( F(x,ay_1 + by_2 , p) = a\,F(x,y_1 , p) + b\,F(x, y_2 , p) \) for any constants a, b, and similar for variable p), then \( y'' = F\left( x,y, y' \right) \) is called linear.

For example, the equation \( y'' = \sin x + 3 y^2 + 2 \left( y' \right)^2 \) is a second order nonlinear differential equation, while the equation \( y'' = (\cos x)\,y \) is a linear one.

A function \( y=\phi (x) \) is a solution of \( y'' = F\left( x,y, y' \right) \) in some interval \( a < x < b \) (perhaps infinite), having derivatives up to the second order throughout the interval, if φ(x) satisfies the differential equation in the interval (a,b), that is,

\[ \frac{{\text d}^2 \phi}{{\text d} x^2} = F\left( x,\phi (x),\frac{{\text d}\phi}{{\text d}x} \right) \qquad \mbox{ for all } \ x\in (a,b). \]

For many of the differential equations to be considered, it will be found that solutions of \( y'' = F\left( x,y, y' \right) \) can be included in one formula, either explicit

\[ y=\phi (x, C_1 , C_2 ) \qquad \mbox{or implicit} \qquad \Phi (x,y, C_1 , C_2 )=0, \]
where C1 and C2 are arbitrary constants. Such a solution is referred to as the general solution of the differential equation of the second order in either explicit or implicit form. Choosing specific values of the constants C1 and C2, we obtain a particular solution of \( y'' = F\left( x,y, y' \right) . \) All solutions can be so found except, possibly, singular and/or equilibrium solutions.

Second order differential equations are widely used in science and engineering to model real world problems. The most famous second order differential equation is Newton's second law of motion, \( m\,\ddot{y} = F\left( t, y, \dot{y} \right) ,\) which describes a one-dimensional motion of a particle of mass m moving under the influence of a force F. In this equation, y=y(t) is the position of a particle at a time t, \( \dot{y} = {\text d}y/{\text d}t \) is its velocity, \( \ddot{y} = {\text d}^2 y/{\text d}t^2 \) is its acceleration, and F is the total force acting on the particle.

For given two numbers y0 and y1, we impose the initial conditions on y(x) in the form

\begin{equation} \label{E41.2} y( x_0 )=y_0, \quad y' ( x_0 ) = y_1 . %\eqno{(1.2)} \end{equation}
The differential equation \( y'' = F\left( x,y, y' \right) \) with the initial conditions \( y( x_0 )=y_0, \quad y' ( x_0 ) = y_1 \) is called the initial value problem (IVP for short).

Theorem: Suppose that F, \( \partial F/\partial y, \) and \( \partial F/\partial y' \) are continuous in a closed 3-dimensional domain Ω in xyy'-space, and the point \( (x_0 ,y_0 , y'_0 ) \) belongs to Ω. Then the initial value problem \( y'' = F\left( x,y, y' \right) , \quad y( x_0 )=y_0, \quad y' ( x_0 ) = y_1 \) has a unique solution \( y=\phi (x) \) on an x-interval in Ω containing x0. ■

The general linear differential equation of the second order is an equation that can be written as
\begin{equation} \label{E41.3} a_2 (x) \frac{{\text d}^2 y}{{\text d} x^2} + a_{1} (x) \frac{{\text d}y}{{\text d}x} + a_{0} (x) y(x) = g(x). %\eqno{(1.3)} \end{equation}
The functions \( a_0 (x), a_1 (x), a_2 (x), \) are referred to as coefficients of the differential equation and g(x) is a given function, known as driving term, forcing term, or nonhomogeneous term; they all are assumed to be independent of dependent variable y. We will denote by x and/or t the independent variables. Derivatives are usually also denoted by primes (y' or y''); however, it is a custom to use Newton's notation and denote derivatives with respect to time (denoted by t) with dots, so instead of y' we will use \( \dot{y} . \) When a differential equation cannot be written in the above form, then it is called nonlinear. If the function \( a_2 (x) \) has no zeroes on some interval, then we can divide both sides of the equation by \( a_2 (x) \) to obtain its normalized form:
\begin{equation} \label{E41.5} y'' (x) + p (x) \,y' (x) + q (x)\, y(x) = f(x). %\eqno{(1.5)} \end{equation}

The points where the coefficients of \( y'' (x) + p (x) \,y' (x) + q (x)\, y(x) = f(x) \) are discontinuous or undefined are called the singular points of the equation. These points are usually not used in the initial conditions except some cases. For example, the equation \( (x^2 -1)\,y'' + y=1 \) has two singular points x=1 and x=-1 that must be excluded. If in opposite, the initial condition \( y(1) =y_0 \) is imposed, then the differential equation dictates that \( y_0 =1 ; \) otherwise, it has no solution.

Theorem: Let p(x), q(x), and f(x) be continuous functions on an open interval \( a < x < b. \) Then, for each \( x_0 \in (a,b), \) the initial value problem

\[ y'' + p(x)y' + q(x) y =f(x), \qquad y(x_0 ) =y_0 , \quad y' (x_0 ) = y_1 \]
has a unique solution for arbitrary specified real numbers y0, y1.

Equation \( y'' + p(x)y' + q(x) y =f(x) \) is a particular case of the general linear differential equation of the n-th order

\begin{equation} \label{E41.4} a_n (x) \frac{{\text d}^n y}{{\text d} x^n} + a_{n-1} (x) \frac{{\text d}^{n-1} y}{{\text d} x^{n-1}} + \cdots + a_0 (x) y(x) = g(x). %\eqno{(1.4)} \end{equation}
If g(x) is identically zero, the above equations are said to be homogeneous (the accent is on the syllable ``ge''); if g(x) is not identically zero, equations are called nonhomogeneous (or inhomogeneous or driven) and the function g(x) is referred to as the nonhomogeneous term, which is also called the input function or forcing function.

Theorem: Let functions \( a_0 (x), a_1 (x), \ldots , a_n (x) \) and f(x) be defined and continuous on the closed interval \( a\leq x\leq b \) with \( a_n (x) \neq 0 \) for \( x\in [a,b] . \) Let x0 be such that \( a\leq x_0 \leq b \) and let y0, y'0, \( \ldots ,\ y^{(n-1)}_0 \) be any constant. Then in the closed interval [a,b], there exists a unique solution y(x) satisfying the initial value problem:

\[ a_n (x) y^{(n)} + a_{n-1} (x) y^{(n-1)} + \cdots + a_{1} (x) y' + a_0 (x) y = g(x) , \]
\[ y( x_0 )= y_0 , \ y' ( x_0 ) = y'_0 , \ \ldots , \ y^{(n-1)} ( x_0 ) = y^{(n-1)}_0 . \]

Example: Let us consider the initial value problem

\[ t(t^2 -4)\,y'' +t\,y' + (\ln |t|)\,y =0, \qquad y(1) =0, \quad y' (1) =2. \]

Solution: To determine the validity interval (= the longest interval in which the given initial value problem is certain to have a unique twice-differentiable solution), we divide both sides of the differential equation by \( x(x^2 -4)=x(x-2)(x+2) \) to obtain \( y'' + p(x)y' + q(x)y =f(x) \) or

\[ y'' + \frac{1}{x(x-2)}\,y' + \frac{x}{(x-2)(x+2)}\,y = \frac{\sin x}{x} \cdot \frac{1}{(x-2)(x+2)} . \]
The coefficient \( p (x) = 1/x(x-2) \) is not defined at two singular points x=0 and x=2. Similarly, the functions \( q (x) = x/(x^2 -4) \) and \( f(x) = \frac{\sin x}{x} \cdot\frac{1}{(x-2)(x+2)} \) fail to be continuous at singular points \( x=\pm 2. \) So we don't want to choose the initial point x0 as 0 or \( \pm 2. \) For example, if x0 = 1, the given initial value problem has a unique solution in the open interval (0,2). If x0 = 3, the given initial value problem has a unique solution in the interval \( 2 < x < \infty . \) The behavior of a solution at these singularities requires additional analysis.




Return to Mathematica page

Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)
Return to the Part 7 (Boundary Value Problems)