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

Return to computing page for the second course APMA0330

Return to Mathematica tutorial page for the first course

Return to Mathematica tutorial page for the second course

Return to the main page for the course APMA0330

Return to the main page for the course APMA0340

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

*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} . \)

AllSoln[x_]=Soln.{c1,c2}

Higher Order Equations

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

Composition of Linear Differential Operators:

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]