Wolfram Language

Partial Differential Equations

Solve an Initial-Boundary Value Problem for a First-Order PDE

Specify a linear first-order partial differential equation.

In[1]:=
Click for copyable input
eqn = D[u[t, x], t] + D[u[t, x], x] == 0;

Prescribe initial and boundary conditions for the equation.

In[2]:=
Click for copyable input
ibc = {u[t, 0] == 0, u[0, x] == E^(-x) Sin[x]^2};

Solve the problem using DSolveValue.

In[3]:=
Click for copyable input
sol = DSolveValue[{eqn, ibc}, u[t, x], {t, x}] // FullSimplify
Out[3]=

Visualize the solution.

In[4]:=
Click for copyable input
Plot3D[sol // Evaluate, {t, 0, 3}, {x, 0, 3}, Exclusions -> None]
Out[4]=

Related Examples

de es fr ja ko pt-br ru zh