# Wolfram Mathematica

## Solve a Boundary Value Problem Using a Green's Function

Solve the following second-order differential equation subject to the given homogeneous boundary conditions.

In:= `eqn = -u''[x] - u'[x] + 6 u[x] == f[x];`
In:= `bc0 = u == 0;`
In:= `bc1 = u == 0;`

The forcing term is given by the following function f[x].

In:= `f[x_] := E^(-a x)`

Compute the Green's function for the corresponding differential operator.

In:= `gf[y_, x_] = GreenFunction[{eqn[], bc0, bc1}, u[x], {x, 0, 1}, y]`
Out= Plot the Green's function for different values of lying between 0 and 1.

In:= `Plot[Table[gf[y, x], {y, 0, 1, 0.2}] // Evaluate, {x, 0, 1}]`
Out= The solution of the original differential equation with the given forcing term can now be computed using a convolution integral on the interval .

In:= ```sol = Integrate[gf[y, x] f[y], {y, 0, 1}, Assumptions -> 0 < x < 1] // Simplify```
Out= Plot the solution for different values of the parameter .

In:= `Plot[Table[sol, {a, {1/4, 1, 2, 4}}] // Evaluate, {x, 0, 1}]`
Out= 