« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Parametric Differential Equations
Parametric Dependence
Plot the dependence of
on a parameter
a
in the differential equation.
In[2]:=
X
Plot[pfun[a], {a, -4, 4}, AxesLabel -> {a, \!\( \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(5\)]\(y[s, a] \[DifferentialD]s\)\)}, ImageSize -> Medium]
In[3]:=
X
outFun[f_] := ParametricNDSolveValue[eqns, f, {t, 0, 5}, {a}]; dataRow[f_] := Plot[outFun[f][pa], {pa, -3, 3}, AxesLabel -> {a, f}, ImageSize -> Small]; outputs = {{y[1] + y[2], \!\( \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(5\)]\(y[ s] \[DifferentialD]s\)\)}, {y'[3], y[Abs[a]]}};
In[4]:=
X
Grid[Map[dataRow, outputs, {2}], Frame -> All, ItemStyle -> {Automatic}, Spacings -> {1.5, 1.5}]
In[1]:=
X
eqns = {y''[t] + y[t] == 3 a Sin[y[t]], y[0] == y'[0] == 1}; pfun = ParametricNDSolveValue[eqns, \!\( \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(5\)]\(y[ s] \[DifferentialD]s\)\), {t, 0, 5}, {a}];
Out[2]=
Find the dependence of several other expressions on the parameter
a
.
Out[4]=