« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Parametric Differential Equations
Sensitivity of a Parametric Wave Equation
In[2]:=
X
Panel@Grid[ Join[{{"", "a", "c"}}, Table[{StringJoin["t = ", ToString[\[Tau]]], Plot[Evaluate[(pfun[a, c][\[Tau], x] + .5 {0, 1, -1} D[pfun[a, c][\[Tau], x], a]) /. {a -> 1, c -> 1}], {x, -10, 10}, Filling -> {2 -> {3}}, PlotRange -> All], Plot[Evaluate[(pfun[a, c][\[Tau], x] + .5 {0, 1, -1} D[pfun[a, c][\[Tau], x], c]) /. {a -> 1, c -> 1}], {x, -10, 10}, Filling -> {2 -> {3}}, PlotRange -> All]}, {\[Tau], {1, 3, 5}}]]]
In[3]:=
X
ColorSensitivityPlot3D[f_, fsense_, opts___] := Block[{fs = fsense}, Plot3D[f, {t, 0, 5}, {x, -10, 10}, Mesh -> None, ColorFunction -> Function[{t, x}, ColorData["LakeColors"][fs]], PlotPoints -> 60, ColorFunctionScaling -> False, opts]]; {ColorSensitivityPlot3D[pfun[1, 1][t, x], Abs[ifda[t, x]], PlotLabel -> a, PlotRange -> All], ColorSensitivityPlot3D[pfun[1, 1][t, x], .25 Abs[ifdc[t, x]], PlotLabel -> c, PlotRange -> All]}
Find and plot the parametric sensitivity of a parameterized wave equation.
In[1]:=
X
pfun = ParametricNDSolveValue[{D[u[t, x], t, t] == c^2 D[u[t, x], x, x], u[0, x] == Exp[-(a x)^2], Derivative[1, 0][u][0, x] == 0, u[t, -10] == u[t, 10]}, u, {t, 0, 5}, {x, -10, 10}, {a, c}]; ifun = pfun[1, 1]; ifda = D[pfun[a, 1], a] /. {a -> 1}; ifdc = D[pfun[1, c], c] /. {c -> 1};
Show the sensitivity to the initial wave height
a
and wave speed
c
.
Out[2]=
Another way to visualize the solution sensitivity is to vary the color of the solution surface.
Out[3]=