Tutorial file 2. MA530

Examples are from O'Neil "Advanced Engineering Mathematics" 6th ed.

Second order homogeneuos linear equations with constant coefficients

Example 2.6. p. 73 Case 1: A^2-4B>0. Find the general solution of y''(x)-y'(x)-6y(x)=0

\(DSolve[\(y''\)[x] - \(y'\)[x] - 6  y[x] == 0, 
	y[x], 
      x]\)

% // FullSimplify

Example 2.7. p. 74 Case 2: A^2-4B=0. Find the general solution of y''(x)-6y'(x)+9y(x)=0

\(DSolve[\(y''\)[x] - 6 \( y'\)[x] + 9  y[x] == 0, 
	y[x], 
      x]\)

% // FullSimplify

Example 2.8. p. 73 Case 3: A^2-4B<0. Find the general solution of y''(x)+2y'(x)+6y(x)=0

\(DSolve[\(y''\)[x] + 2 \( y'\)[x] + 6  y[x] == 0, 
	y[x], 
      x]\)

% // FullSimplify

Find the general solution of y''(t)+5y'(t)+10y(t)=0

\(DSolve[\(y''\)[t] + 5 \( y'\)[t] + 10  y[t] == 0, 
	y[t], 
      t]\)

% // FullSimplify

Find the general solution of 2y''(t)+7y'(t)+3y(t)=0

\(DSolve[2 \( y''\)[t] + 7 \( y'\)[t] + 3  y[t] == 0, 
	y[t], 
      t]\)

% // FullSimplify

Find the general solution of y''(t)+17y(t)=0

\(DSolve[2 \( y''\)[t] + 17  y[t] == 0, 
	y[t], t]\)

% // FullSimplify

Solve the initial value problem and plot the solution y''(t)+5y'(t)+10y(t)=0, y(0)=3, y'(0)=5

\(DSolve[{\(y''\)[t] + 5 \( y'\)[t] + 10  y[t] == 0, 
        y[0] == 3, \(y'\)[0] == 5}, 
	y[t], t]\)

Plot[Evaluate[y[t] /. %], {t, 0, 5},  
        PlotRange -> All];

Solve the initial value problem and plot the solution  2y''(t)+7y'(t)+3y(t)=0, y(0)=3,y'(0)=5

\(DSolve[{2 \( y''\)[t] + 7 \( y'\)[t] + 3  y[t] == 0, 
        y[0] == 3, \(y'\)[0] == 5}, 
	y[t], t]\)

Plot[Evaluate[y[t] /. %], {t, 0, 15}];

Solve the initial value problem and plot the solution y''(t)+17y(t)=0, y(0)=3, y'(0)=5

\(DSolve[{2 \( y''\)[t] + 17  y[t] == 0, 
        y[0] == 3, \(y'\)[0] == 5}, 
	y[t], t]\)

Plot[Evaluate[y[t] /. %], {t, 0, 15}];

Euler's Equation

Example 2.11. p. 79.  Find the general solution of (x^2)y''(x)+2xy'(x)-6y(x)=0

\(DSolve[\(y''\)[x] x^2 + 2 \( y'\)[x] x - 6  y[x] == 0, 
	y[x], 
      x]\)

% // FullSimplify

Example 2.14. p. 80.  Solve the initial value problem  (x^2)y''(x)-5xy'(x)+10y(x)=0, y(1)=4, y'(1)=-6

\(DSolve[{\(y''\)[x] x^2 - 5 \( y'\)[x] x + 10  y[x] == 0, \ 
        y[1] == 4, \(y'\)[1] == \(-6\)}, 
	y[x], x]\)

The nonhomogeneous equation y''+p(x)y'+q(x)y=f(x)

The method of variation of parameters

Example 2.16. p. 83  Find the general solution of y''-4y'/x+4y/(x^2)=x^2 + 1

First let us find the general solution directly:

\(DSolve[\(y''\)[x] - 4 \( y'\)[x]/x + 4  y[x]/\((x^2)\) == 
        x^2 + 1, 
	y[x], x]\)

% // FullSimplify

Let us denote this solution as:

ygen[x_] = -((x^2)/2) + x C[1] + 
          (x^4) (-(1/9) + C[2]) + (1/3) (x^4) Log[x];

Now let us apply the method of variation of parameters

1) Find the general solution of the homogeneous Euler equation:

\(DSolve[\(y''\)[x] - 4 \( y'\)[x]/x + 4  y[x]/\((x^2)\) == 0, 
	
      y[x], x]\)

then the fundametal solutions are y1=x, and y2=x^4

2) Find a particular solution:

Let us compute the Wronskian of the fundamental solutions

Det[(({{x, x^4}, {1, 4  x^3}}))]

Then the particular solution is (we use (2.10) and (2.12) p. 82):

-x∫((((x^4) (x^2 + 1))/(3 
                   x^4)))\[DifferentialD]x+(x^4)∫(((x (x^2 + 1))/(3  x^4)))\[DifferentialD]x

% // FullSimplify

And so the general solution is :

yg[x_] = 
        x C[1] + (x^4) C[2] + 
          (1/18) (x^2) (-9 - 2 (x^2) + 
                6 (x^2) Log[x]) ;

Finally let us compare ygen[x]  and yg[x]

ygen[x] - yg[x]

The method of undetermined coefficients

Example 2.17. p. 85  Solve y''-4y=8x^2 -2x

First let us find the general solution directly:

DSolve[y''[x] - 4  y[x] == 8  x^2 - 2, y[x], x]

% // FullSimplify

Let us denote this solution as:

ygs[x_] = -(1/2) - 
          2 (x^2) + (E^(2 x)) C[
              1] + (E^(-2 x)) C[2];

Now let us apply the method of undetermined coefficients

1) Find the general solution:

DSolve[y''[x] - 4  y[x] == 0, y[x], x]

then the fundametal solutions are y1=e^(2x), and y2=e^(-2x) and the genral solution is:

yhg[
        x_] := (E^(2 x)) C[
            1] + (E^(-2 x)) C[2]

2) Find a particular solution:

Let us guess a particular solution of the form yp(x)=ax^2+bx+c, and substitute this into the differential equation to determine the coefficients:

yp[x_] := a*x^2 + b*x + c

P[x_] := yp''[x] - 4  yp[x] - 8*x^2 + 2

Now we can find the coefficients:

LC = CoefficientList[P[x], x]

Solve[LC == 0, {a, b, c}]

and the particular solution is:

yps[x_] := -2*x^2 - 1/2

And so the general solution of the nongomogeneous system is :

ygns[x_] = yhg[x] + yps[x]

Finally let us compare ygen[x]  and yg[x]

ygs[x] - ygns[x]