TransWikia.com

Non-linear equation

Mathematica Asked by Armin Sharafi on June 20, 2021

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.

2 Answers

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

Answered by Ulrich Neumann on June 20, 2021

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}}
 ]

Answered by Michael E2 on June 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP