# Preface

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 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

# General Solutions

Consider linear differential operator of order *n*:

*x*).

**Theorem:** If coefficients \( a_n (x), a_{n-1} (x), \ldots , a_0 (x) \)
are continuous functions on some interval |a,b| and \( a_n (x) \ne 0 , \) then the homogeneous
linear differential equation \( L \left[ x, \texttt{D} \right] y =0 , \) which can be written as

*n*linearly independent solutions \( \left\{ y_1 (x), y_2 (x), \ldots , y_n (x) \right\} \) that are continuous on the interval |a,b|. Then the

**general solution**of the equation on the interval is

**Theorem:** Let *y*_{p} be any particular solution of the nonhomogeneous linear *n*-th
order differential equation

**general solution**of the nonhomogeneous equation \( L \left[ x, \texttt{D} \right] y = f(x) \) on the interval is

As we see from the previous Theorem, the general solution of a nonhomogeneous linear equation consists of the sum of two functions:

**complementary function**for nonhomogeneous equation. In other words, to solve a nonhomogeneous linear differential equation \( L \left[ x, \texttt{D} \right] y = f(x) \) we first solve the associated homogeneous equation \( L \left[ x, \texttt{D} \right] y = 0 \) and then find any particular solution of the nonhomogeneous equation.

If all coefficients of the linear differential operator \( L \left[ \texttt{D} \right] \)
are constants, then the general solution of the corresponding homogeneous equation \( L \left[ x, \texttt{D} \right] y = 0 \)
exist for all *x* on real axis. In this case, it is [possible to find the fundamental set of solutions explicitly.
Following Leonhard Euler, we seek solutions to the homogeneous linear constant coefficient equation

*n*, denoted by \( L(\lambda ) , \) is called the

**characteristic polynomial**corresponding to the linear constant coefficient differential operator \( L \left[ \texttt{D} \right] = a_n \texttt{D}^n + \cdots + a_1 \texttt{D} + a_0 . \) If the characteristic equation \( L(\lambda ) =0 \) has

*n*distinct roots (real or complex), we get

*n*linearly independent exponential solutions that constitute the fundamental set of solutions for the given homogeneous linear constant coefficient differential equation.

A particular interest is a second order differential equation. Let us consider the equation of motion for
undriven damped harmonic oscillator (coefficients μ and ω_{0} > 0 are assumed constants)

Example: We consider the second order linear differential operator:

*C*

_{1}and

*C*

_{1}are arbitrary constants.

first = s /. roots[[1]]

second = s /. roots[[2]]

root = {first, second}

Soln = Map[Exp[# x] &, root]

Example: We consider the third order linear differential operator:

*Mathematica*to show that these functions indeed form a fundamental set of solutions.

char[lambda_] =Coefficient[L[x,Function[t,Exp[lambda t]]],Exp[lambda x]]

roots = r /. Solve[char[r] == 0, r]

solns = Map[Function[k, Exp[k x]], roots]

y[x_] = solns.{c2,c1,c3} (

L[x_,y_] =y''[x] -y'[x]- 6y[x]

CharPoly[lambda_] =Coefficient[L[x,Exp[lambda #]&], Exp[lambda x]]

roots =lambda/.Solve[CharPoly[lambda]==0,lambda]

Clear[x,y];

L[x_, y_] = y'''[x] - 2 y''[x] - 5 y'[x] + 6 y[x]

DSolve[L[x, y] == 0, y[x], x]

y[x_] = Expand[y[x] /. %[[1]] ]

basis = Table[Coefficient[y[x], C[i]], {i, 1, 3}]

Factor[Coefficient[L[x, Function[t, Exp[r t]]], Exp[r x]]]

W[x_] = NestList[Function[t, D[t, x]], basis, 2]

Det[W[x]]

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)