Solve parametric differential equation using Mathematica

943 Views Asked by At

Using the method of characteristics on a PDE system, I have gotten a parametric differential equation $$ \frac{dy}{dx} = \frac{y - xy}{1 + xy - x}. $$ where $x$ and $y$ are both functions of a third variable $t$. How could I use Mathematica to solve for the solution curve that $(x(t), y(t))$ follows? There is a similar approach done here: Does this simple 2D dynamical system have a conserved quantity?.

EDIT: The system where this came from is \begin{align*} \frac{dx}{dt} &= x - xy \\ \frac{dy}{dt} &= 1 + xy - y \end{align*}

EDIT2: Just to be clear, I know how to draw solution curves with Mathematica. What I am wondering if there is a way to solve the equation analytically and get a closed form curve as the solution.

2

There are 2 best solutions below

0
On

enter image description here

ai = -0.4; tm = 10;
EQ = {X'[t] == X[t] (1 - Y[t]), Y'[t] == 1 + Y[t] (X[t] - 1), 
   X[0] == ai, Y[0] == 2.75};
NDSolve[EQ, {X, Y}, {t, 0, tm}];
{x[u_], y[u_]} = {X[u], Y[u]} /. First[%];
p1 = ParametricPlot[{x[t], y[t]}, {t, 0, tm}, GridLines -> Automatic, 
  AspectRatio -> 1, PlotRange -> All, PlotStyle -> {Thick, Blue}]

The above is Mathematica coding (that can be subtantially improved) for three boundary conditions (blue,red,magenta) $ { (x_i,y_i)= (-0.4,2.75),(-.2,4), (4.4,3.75) } $

Mathematica Link

2
On

Attached some MATHEMATICA code to help in this question

grf0 = StreamPlot[{x - x y, 1 - x y - y}, {x, -8, 8}, {y, -8, 8}]; sols = Solve[{x - x y == 0, 1 - x y - y == 0}, {x, y}]; pts = {x, y} /. sols; grpts = Table[Graphics[{Red, Disk[pts[[i]], 0.2]}], {i, 1, Length[pts]}]; tmax = 5; sols = NDSolve[{x'[t] == x[t] - x[t] y[t], y'[t] == 1 - x[t] y[t] - y[t], x[0] == -7, y[0] == 1}, {x, y}, {t, 0, tmax}]; gr2 = ParametricPlot[Evaluate[{x[t], y[t]} /. sols], {t, 0, tmax},PlotStyle -> Red]; Show[grf0, grpts, gr2]

enter image description here