The OP seems maybe to want X
as a function of x
, but the OP gives up an equation that defines X
as a function of t
. No good clue about how to incorporate x
into the solution X(t)
as defined by the given equation.
Here’s one way to go about finding X(t)
numerically. The equation has a 3-parameter family of solutions, so we seek an order-3 differential equation for the family. This turns out to be easy. Next we need to find initial conditions for X(t0)
, X'(t0)
, X''(t0)
in terms of the parameters a
, b
, B
. This is easy if t0 = 0
. We get two solution components psolM
/psolP
because the initial condition for X(0)
is a quadratic equation (M
for minus √, P
for plus √).
eqn = X(t) (X(t) - a) + b Exp(-2 X(t) t) == B;
sys = NestList(D(#, t) &, eqn, 3);
ode = Eliminate(sys, {a, b, B});
ics = Solve(Most@sys /. t -> 0,
NestList(D(#, t) &, X(t), 2) /. t -> 0);
Length@ics (* number of solutions = 2 *)
(* 2 *)
{psolM, psolP} =
ParametricNDSolveValue({ode, #}, X, {t, -2, 2}, {a, b, B},
Method -> "StiffnessSwitching") & /@ (ics /. Rule -> Equal);
nosol = Verbatim(ParametricFunction)(___)(___) ->
Interpolation({{-2., Indeterminate}, {2., Indeterminate}},
InterpolationOrder -> 1);
Manipulate(
Quiet@ListLinePlot({psolM(a, b, B), psolP(a, b, B)} /. nosol,
InterpolationOrder -> 3, PlotRange -> {{-2, 2}, {-5, 5}},
PlotLabel ->
Pane(Style($MessageList, "Label"), {320, 60},
Alignment -> Center)),
{{a, 1}, -4, 4, Appearance -> "Labeled"},
{b, 1, 5, Appearance -> "Labeled"},
{{B, 4}, 1, 5, Appearance -> "Labeled"},
AutorunSequencing -> {{1, 3}, {2, 3}, {3, 3}}
)