Wolfram Language

Symbolic & Numeric Calculus

Solve an Initial Value Problem Using a Green's Function

Solve an initial value problem for an inhomogeneous differential equation using GreenFunction.

First, compute the Green's function.

In[1]:=
Click for copyable input
gf[s_, t_] = GreenFunction[{-u''[t] + u'[t] - 37/4 u[t], u[0] == 0, u'[0] == 0}, u[t], {t, 0, \[Infinity]}, s]
Out[1]=

Define a forcing function.

In[2]:=
Click for copyable input
f[t_] := Cos[a t]

Convolving the Green's function with the forcing function yields the solution.

In[3]:=
Click for copyable input
sol = Integrate[gf[s, t] f[s], {s, 0, \[Infinity]}, Assumptions -> t > 0]
Out[3]=

Compare with the result given by DSolveValue.

In[4]:=
Click for copyable input
DSolveValue[{-u''[t] + u'[t] - 37/4 u[t] == f[t], u[0] == 0, u'[0] == 0}, u[t], t] // FullSimplify
Out[4]=

Plot the solution for different values of the parameter .

In[5]:=
Click for copyable input
Plot[Table[sol, {a, 1, 4, 0.8}] // Evaluate, {t, 3, 6}]
Out[5]=

Related Examples

de es fr ja ko pt-br ru zh