-1
$\begingroup$

I have to solve this equation but the problem is X is function of x it means X[x]

$$X(X-a)+ b e^{-2 X t}=B,$$

a,b,B are constants.

How we can I get some result for this equation? Plot as well X(x) but x is also function of t.

$\endgroup$
5
  • 2
    $\begingroup$ Couldn't find a small x in your equation? $\endgroup$ – Ulrich Neumann Dec 30 '20 at 18:49
  • $\begingroup$ X is X[x] I believe...but I don't understand what the OP wants for a solution....or what they intend to plot with unknown constants. $\endgroup$ – morbo Dec 30 '20 at 18:52
  • $\begingroup$ From the context of the question I think the desired quantity is X(x(t)) and then plot it vs t... This is just a speculation though $\endgroup$ – DiSp0sablE_H3r0 Dec 30 '20 at 18:58
  • $\begingroup$ People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this meta Q&A helpful $\endgroup$ – Michael E2 Dec 30 '20 at 19:52
  • $\begingroup$ You need to formulate better. There is X, x and t. It is not clear what is a function what, and what needs to be found. $\endgroup$ – yarchik Dec 31 '20 at 12:21
4
$\begingroup$

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}}
 ]
$\endgroup$
3
$\begingroup$

Mathematica cannot solve your equation for X . Instead try to solve it for t

sol=Solve[X (X - a) + b Exp[-2 X t] == B, t ][[1]] /. C[1] -> 0(*forces real solution*)
(*{t -> Log[b/(B + a X - X^2)]/(2 X)}*)

Now you know t as a function of X. For examplary parameters you can plot the result

ParametricPlot[{t, X} /. sol  /. {a -> 1/5, b -> 1, B -> 3/2}, {X, -2,2}, AxesLabel -> {t, X}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.