# Boundary Value Problems

This tutorial contains many Mathematica scripts. You, as the user, are free to use all codes for your needs, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. Any comments and/or contributions for this tutorial are welcome; you can send your remarks to <Vladimir_Dobrushkin@brown.edu>

Ordinary differential equations (ODEs) may be divided into two classes: linear equations and nonlinear equations. The latter have a richer mathematical structure than linear equations and generally more difficult to solve in closed form. Unforutnately, the techniques applicable for solving second order nonlinear ODEs are not available at an undergraduate level. Therefore, we concentrate our attention on linear differential equations.

## II. Linear Differential Operators

The general linear differential equation of the second order is an equation of the form

$a_2 (x) \,\frac{{\text d}^2 y}{{\text d}x^2} + a_1 (x) \,\frac{{\text d} y}{{\text d}x} + a_0 y(x) = g(x) ,$
where $$a_2 (x) , \ a_1 (x) , \ a_0 (x)$$ are known coefficients and g(x) is a given functon, known as driven term, forcing term, or nonhomogeneous term. We will use variables x and t as independent varibiables, and other (lower case) letters for dependent 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} .$$
Out[15]= {-2, 3}
Soln = Map[Exp[# x] &, roots]
AllSoln[x_]=Soln.{c1,c2}
Out[17]= c1 E^(-2 x) + c2 E^(3 x)
Simplify[L[x, AllSoln] == 0] (* check the answer *)
Out[18]= True
DSolve[y''[x] - y'[x] - 6 y[x] == 0, y[x], x]

Higher Order Equations

L[x_, y_] = y'''[x] - 2 y''[x] - 5 y'[x] + 6 y[x]
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} (
Clear[x, y];
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]
* or *)
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]]
Out[7]= 30 E^(2 x) (* Wronskian *)

Composition of Linear Differential Operators:

L2[x_, y_] := a[2] D[y[x], {x, 2}] + a[1] D[y[x], {x, 1}] + a[0] y[x]
L3[x_, y_] := b[3] D[y[x], {x, 3}] + b[2] D[y[x], {x, 2}] + b[1] D[y[x], {x, 1}] + b[0] y[x]
L2L3 = Collect[L2[x, Function[z, L3[z, y]]], y]