2.2.4 Problem 5

Solved using first_order_ode_autonomous
Solved using first_order_ode_exact
Solved using first_order_ode_dAlembert
Maple
Mathematica
Sympy

Internal problem ID [19714]
Book : Elementary Differential Equations. By Thornton C. Fry. D Van Nostrand. NY. First Edition (1929)
Section : Chapter IV. Methods of solution: First order equations. section 24. Problems at page 62
Problem number : 5
Date solved : Friday, November 28, 2025 at 06:31:06 PM
CAS classification : [_quadrature]

Solved using first_order_ode_autonomous

Time used: 0.170 (sec)

Solve

\begin{align*} x^{\prime }&=k \left (A -n x\right ) \left (M -m x\right ) \\ \end{align*}
Integrating gives
\begin{align*} \int \frac {1}{k \left (-x n +A \right ) \left (-m x +M \right )}d x &= dt\\ \frac {\ln \left (-x n +A \right )}{k \left (A m -M n \right )}-\frac {\ln \left (-m x +M \right )}{k \left (A m -M n \right )}&= t +c_1 \end{align*}

Singular solutions are found by solving

\begin{align*} k \left (-x n +A \right ) \left (-m x +M \right )&= 0 \end{align*}

for \(x\). This is because we had to divide by this in the above step. This gives the following singular solution(s), which also have to satisfy the given ODE.

\begin{align*} x = \frac {A}{n}\\ x = \frac {M}{m} \end{align*}

The following diagram is the phase line diagram. It classifies each of the above equilibrium points as stable or not stable or semi-stable.

Simplifying the above gives

\begin{align*} \frac {\ln \left (A -n x\right )-\ln \left (M -m x\right )}{k \left (A m -M n \right )} &= t +c_1 \\ x &= \frac {A}{n} \\ x &= \frac {M}{m} \\ \end{align*}
Solving for \(x\) gives
\begin{align*} x &= \frac {A}{n} \\ x &= \frac {M}{m} \\ x &= \frac {A \,{\mathrm e}^{-A c_1 k m -A k m t +M c_1 k n +M k n t}-M}{{\mathrm e}^{-A c_1 k m -A k m t +M c_1 k n +M k n t} n -m} \\ \end{align*}

Summary of solutions found

\begin{align*} x &= \frac {A}{n} \\ x &= \frac {M}{m} \\ x &= \frac {A \,{\mathrm e}^{-A c_1 k m -A k m t +M c_1 k n +M k n t}-M}{{\mathrm e}^{-A c_1 k m -A k m t +M c_1 k n +M k n t} n -m} \\ \end{align*}
Solved using first_order_ode_exact

Time used: 0.369 (sec)

To solve an ode of the form

\begin{equation} M\left ( x,y\right ) +N\left ( x,y\right ) \frac {dy}{dx}=0\tag {A}\end{equation}
We assume there exists a function \(\phi \left ( x,y\right ) =c\) where \(c\) is constant, that satisfies the ode. Taking derivative of \(\phi \) w.r.t. \(x\) gives
\[ \frac {d}{dx}\phi \left ( x,y\right ) =0 \]
Hence
\begin{equation} \frac {\partial \phi }{\partial x}+\frac {\partial \phi }{\partial y}\frac {dy}{dx}=0\tag {B}\end{equation}
Comparing (A,B) shows that
\begin{align*} \frac {\partial \phi }{\partial x} & =M\\ \frac {\partial \phi }{\partial y} & =N \end{align*}

But since \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) then for the above to be valid, we require that

\[ \frac {\partial M}{\partial y}=\frac {\partial N}{\partial x}\]
If the above condition is satisfied, then the original ode is called exact. We still need to determine \(\phi \left ( x,y\right ) \) but at least we know now that we can do that since the condition \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is
\[ M(t,x) \mathop {\mathrm {d}t}+ N(t,x) \mathop {\mathrm {d}x}=0 \tag {1A} \]
Therefore
\begin{align*} \mathop {\mathrm {d}x} &= \left (k \left (-x n +A \right ) \left (-m x +M \right )\right )\mathop {\mathrm {d}t}\\ \left (-k \left (-x n +A \right ) \left (-m x +M \right )\right ) \mathop {\mathrm {d}t} + \mathop {\mathrm {d}x} &= 0 \tag {2A} \end{align*}

Comparing (1A) and (2A) shows that

\begin{align*} M(t,x) &= -k \left (-x n +A \right ) \left (-m x +M \right )\\ N(t,x) &= 1 \end{align*}

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

\[ \frac {\partial M}{\partial x} = \frac {\partial N}{\partial t} \]
Using result found above gives
\begin{align*} \frac {\partial M}{\partial x} &= \frac {\partial }{\partial x} \left (-k \left (-x n +A \right ) \left (-m x +M \right )\right )\\ &= \left (\left (-2 x n +A \right ) m +M n \right ) k \end{align*}

And

\begin{align*} \frac {\partial N}{\partial t} &= \frac {\partial }{\partial t} \left (1\right )\\ &= 0 \end{align*}

Since \(\frac {\partial M}{\partial x} \neq \frac {\partial N}{\partial t}\), then the ODE is not exact. Since the ODE is not exact, we will try to find an integrating factor to make it exact. Let

\begin{align*} A &= \frac {1}{N} \left (\frac {\partial M}{\partial x} - \frac {\partial N}{\partial t} \right ) \\ &=1\left ( \left ( k n \left (-m x +M \right )+k \left (-x n +A \right ) m\right ) - \left (0 \right ) \right ) \\ &=\left (\left (-2 x n +A \right ) m +M n \right ) k \end{align*}

Since \(A\) depends on \(x\), it can not be used to obtain an integrating factor. We will now try a second method to find an integrating factor. Let

\begin{align*} B &= \frac {1}{M} \left ( \frac {\partial N}{\partial t} - \frac {\partial M}{\partial x} \right ) \\ &=-\frac {1}{k \left (-x n +A \right ) \left (-m x +M \right )}\left ( \left ( 0\right ) - \left (k n \left (-m x +M \right )+k \left (-x n +A \right ) m \right ) \right ) \\ &=\frac {\left (-2 x n +A \right ) m +M n}{\left (-x n +A \right ) \left (-m x +M \right )} \end{align*}

Since \(B\) does not depend on \(t\), it can be used to obtain an integrating factor. Let the integrating factor be \(\mu \). Then

\begin{align*} \mu &= e^{\int B \mathop {\mathrm {d}x}} \\ &= e^{\int \frac {\left (-2 x n +A \right ) m +M n}{\left (-x n +A \right ) \left (-m x +M \right )}\mathop {\mathrm {d}x} } \end{align*}

The result of integrating gives

\begin{align*} \mu &= e^{-\ln \left (\left (-m x +M \right ) \left (-x n +A \right )\right ) } \\ &= \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )} \end{align*}

\(M\) and \(N\) are now multiplied by this integrating factor, giving new \(M\) and new \(N\) which are called \(\overline {M}\) and \(\overline {N}\) so not to confuse them with the original \(M\) and \(N\).

\begin{align*} \overline {M} &=\mu M \\ &= \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )}\left (-k \left (-x n +A \right ) \left (-m x +M \right )\right ) \\ &= -k \end{align*}

And

\begin{align*} \overline {N} &=\mu N \\ &= \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )}\left (1\right ) \\ &= \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )} \end{align*}

So now a modified ODE is obtained from the original ODE which will be exact and can be solved using the standard method. The modified ODE is

\begin{align*} \overline {M} + \overline {N} \frac { \mathop {\mathrm {d}x}}{\mathop {\mathrm {d}t}} &= 0 \\ \left (-k\right ) + \left (\frac {1}{\left (-x n +A \right ) \left (-m x +M \right )}\right ) \frac { \mathop {\mathrm {d}x}}{\mathop {\mathrm {d}t}} &= 0 \end{align*}

The following equations are now set up to solve for the function \(\phi \left (t,x\right )\)

\begin{align*} \frac {\partial \phi }{\partial t } &= \overline {M}\tag {1} \\ \frac {\partial \phi }{\partial x } &= \overline {N}\tag {2} \end{align*}

Integrating (1) w.r.t. \(t\) gives

\begin{align*} \int \frac {\partial \phi }{\partial t} \mathop {\mathrm {d}t} &= \int \overline {M}\mathop {\mathrm {d}t} \\ \int \frac {\partial \phi }{\partial t} \mathop {\mathrm {d}t} &= \int -k\mathop {\mathrm {d}t} \\ \tag{3} \phi &= -t k+ f(x) \\ \end{align*}
Where \(f(x)\) is used for the constant of integration since \(\phi \) is a function of both \(t\) and \(x\). Taking derivative of equation (3) w.r.t \(x\) gives
\begin{equation} \tag{4} \frac {\partial \phi }{\partial x} = 0+f'(x) \end{equation}
But equation (2) says that \(\frac {\partial \phi }{\partial x} = \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )}\). Therefore equation (4) becomes
\begin{equation} \tag{5} \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )} = 0+f'(x) \end{equation}
Solving equation (5) for \( f'(x)\) gives
\[ f'(x) = \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )} \]
Integrating the above w.r.t \(x\) gives
\begin{align*} \int f'(x) \mathop {\mathrm {d}x} &= \int \left ( \frac {1}{\left (-x n +A \right ) \left (-m x +M \right )}\right ) \mathop {\mathrm {d}x} \\ f(x) &= \frac {\ln \left (-x n +A \right )}{A m -M n}-\frac {\ln \left (-m x +M \right )}{A m -M n}+ c_1 \\ \end{align*}
Where \(c_1\) is constant of integration. Substituting result found above for \(f(x)\) into equation (3) gives \(\phi \)
\[ \phi = -t k +\frac {\ln \left (-x n +A \right )}{A m -M n}-\frac {\ln \left (-m x +M \right )}{A m -M n}+ c_1 \]
But since \(\phi \) itself is a constant function, then let \(\phi =c_2\) where \(c_2\) is new constant and combining \(c_1\) and \(c_2\) constants into the constant \(c_1\) gives the solution as
\[ c_1 = -t k +\frac {\ln \left (-x n +A \right )}{A m -M n}-\frac {\ln \left (-m x +M \right )}{A m -M n} \]
Simplifying the above gives
\begin{align*} \frac {-A k m t +M k n t +\ln \left (A -n x\right )-\ln \left (M -m x\right )}{A m -M n} &= c_1 \\ \end{align*}
Solving for \(x\) gives
\begin{align*} x &= \frac {A \,{\mathrm e}^{-A k m t +M k n t -m c_1 A +M n c_1}-M}{{\mathrm e}^{-A k m t +M k n t -m c_1 A +M n c_1} n -m} \\ \end{align*}

Summary of solutions found

\begin{align*} x &= \frac {A \,{\mathrm e}^{-A k m t +M k n t -m c_1 A +M n c_1}-M}{{\mathrm e}^{-A k m t +M k n t -m c_1 A +M n c_1} n -m} \\ \end{align*}
Solved using first_order_ode_dAlembert

Time used: 14.588 (sec)

Solve

\begin{align*} x^{\prime }&=k \left (A -n x\right ) \left (M -m x\right ) \\ \end{align*}
Let \(p=x^{\prime }\) the ode becomes
\begin{align*} p = k \left (-x n +A \right ) \left (-m x +M \right ) \end{align*}

Solving for \(x\) from the above results in

\begin{align*} \tag{1} x &= \frac {A k m +M k n +\sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p}}{2 k m n} \\ \tag{2} x &= \frac {A k m +M k n -\sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p}}{2 k m n} \\ \end{align*}
This has the form
\begin{align*} x=t f(p)+g(p)\tag {*} \end{align*}

Where \(f,g\) are functions of \(p=x'(t)\). Each of the above ode’s is dAlembert ode which is now solved.

Solving ode 1A

Taking derivative of (*) w.r.t. \(t\) gives

\begin{align*} p &= f+(t f'+g') \frac {dp}{dt}\\ p-f &= (t f'+g') \frac {dp}{dt}\tag {2} \end{align*}

Comparing the form \(x=t f + g\) to (1A) shows that

\begin{align*} f &= 0\\ g &= \frac {A k m +M k n +\sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}}{2 k m n} \end{align*}

Hence (2) becomes

\begin{equation} \tag{2A} p = \frac {p^{\prime }\left (t \right )}{\sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p}} \end{equation}
The singular solution is found by setting \(\frac {dp}{dt}=0\) in the above which gives
\begin{align*} p = 0 \end{align*}

Solving the above for \(p\) results in

\begin{align*} p_{1} &=0 \end{align*}

Substituting these in (1A) and keeping singular solution that verifies the ode gives

\begin{align*} x = \frac {A k m +M k n +\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \end{align*}

The general solution is found when \( \frac { \mathop {\mathrm {d}p}}{\mathop {\mathrm {d}t}}\neq 0\). From eq. (2A). This results in

\begin{equation} \tag{3} p^{\prime }\left (t \right ) = p \left (t \right ) \sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p \left (t \right )} \end{equation}
This ODE is now solved for \(p \left (t \right )\). No inversion is needed.

Integrating gives

\begin{align*} \int \frac {1}{p \sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}}d p &= dt\\ -\frac {\ln \left (A k m -M k n +\sqrt {4 k m n p +\left (A m -M n \right )^{2} k^{2}}\right )}{k \left (A m -M n \right )}+\frac {\ln \left (A k m -M k n -\sqrt {4 k m n p +\left (A m -M n \right )^{2} k^{2}}\right )}{k \left (A m -M n \right )}&= t +c_1 \end{align*}

Singular solutions are found by solving

\begin{align*} p \sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}&= 0 \end{align*}

for \(p \left (t \right )\). This is because we had to divide by this in the above step. This gives the following singular solution(s), which also have to satisfy the given ODE.

\begin{align*} p \left (t \right ) = 0\\ p \left (t \right ) = -\frac {\left (A^{2} m^{2}-2 A M m n +M^{2} n^{2}\right ) k}{4 m n} \end{align*}

Substituing the above solution for \(p\) in (2A) gives

\begin{align*} x &= \frac {A k m +M k n +\sqrt {\left (\left (A m -M n \right )^{2} k -\frac {4 \,{\mathrm e}^{k \left (t +c_1 \right ) \left (A m -M n \right )} k \left (A^{2} m^{2}-2 A M m n +M^{2} n^{2}\right )}{{\mathrm e}^{2 k \left (t +c_1 \right ) \left (A m -M n \right )}+2 \,{\mathrm e}^{k \left (t +c_1 \right ) \left (A m -M n \right )}+1}\right ) k}}{2 k m n} \\ x &= \frac {A k m +M k n +\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +1}{2 k m n} \\ \end{align*}
Solving ode 2A

Taking derivative of (*) w.r.t. \(t\) gives

\begin{align*} p &= f+(t f'+g') \frac {dp}{dt}\\ p-f &= (t f'+g') \frac {dp}{dt}\tag {2} \end{align*}

Comparing the form \(x=t f + g\) to (1A) shows that

\begin{align*} f &= 0\\ g &= \frac {A k m +M k n -\sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}}{2 k m n} \end{align*}

Hence (2) becomes

\begin{equation} \tag{2A} p = -\frac {p^{\prime }\left (t \right )}{\sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p}} \end{equation}
The singular solution is found by setting \(\frac {dp}{dt}=0\) in the above which gives
\begin{align*} p = 0 \end{align*}

Solving the above for \(p\) results in

\begin{align*} p_{1} &=0 \end{align*}

Substituting these in (1A) and keeping singular solution that verifies the ode gives

\begin{align*} x = \frac {A k m +M k n -\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \end{align*}

The general solution is found when \( \frac { \mathop {\mathrm {d}p}}{\mathop {\mathrm {d}t}}\neq 0\). From eq. (2A). This results in

\begin{equation} \tag{3} p^{\prime }\left (t \right ) = -p \left (t \right ) \sqrt {A^{2} k^{2} m^{2}-2 A M \,k^{2} m n +M^{2} k^{2} n^{2}+4 k m n p \left (t \right )} \end{equation}
This ODE is now solved for \(p \left (t \right )\). No inversion is needed.

Integrating gives

\begin{align*} \int -\frac {1}{p \sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}}d p &= dt\\ \frac {\ln \left (A k m -M k n +\sqrt {4 k m n p +\left (A m -M n \right )^{2} k^{2}}\right )}{k \left (A m -M n \right )}-\frac {\ln \left (A k m -M k n -\sqrt {4 k m n p +\left (A m -M n \right )^{2} k^{2}}\right )}{k \left (A m -M n \right )}&= t +c_2 \end{align*}

Singular solutions are found by solving

\begin{align*} -p \sqrt {\left (\left (A m -M n \right )^{2} k +4 m n p \right ) k}&= 0 \end{align*}

for \(p \left (t \right )\). This is because we had to divide by this in the above step. This gives the following singular solution(s), which also have to satisfy the given ODE.

\begin{align*} p \left (t \right ) = 0\\ p \left (t \right ) = -\frac {\left (A^{2} m^{2}-2 A M m n +M^{2} n^{2}\right ) k}{4 m n} \end{align*}

Substituing the above solution for \(p\) in (2A) gives

\begin{align*} x &= \frac {A k m +M k n -\sqrt {\left (\left (A m -M n \right )^{2} k -\frac {4 \,{\mathrm e}^{k \left (t +c_2 \right ) \left (A m -M n \right )} k \left (A^{2} m^{2}-2 A M m n +M^{2} n^{2}\right )}{{\mathrm e}^{2 k \left (t +c_2 \right ) \left (A m -M n \right )}+2 \,{\mathrm e}^{k \left (t +c_2 \right ) \left (A m -M n \right )}+1}\right ) k}}{2 k m n} \\ x &= \frac {A k m +M k n -\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n -1}{2 k m n} \\ \end{align*}
Simplifying the above gives
\begin{align*} x &= \frac {A k m +M k n +\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +\sqrt {k^{2} \left (A m -M n \right )^{2} \tanh \left (\frac {k \left (t +c_1 \right ) \left (A m -M n \right )}{2}\right )^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +1}{2 k m n} \\ x &= \frac {A k m +M k n -\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n -\sqrt {k^{2} \left (A m -M n \right )^{2} \tanh \left (\frac {k \left (t +c_2 \right ) \left (A m -M n \right )}{2}\right )^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n -\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n -1}{2 k m n} \\ \end{align*}
The solution
\[ x = \frac {A k m +M k n -1}{2 k m n} \]
was found not to satisfy the ode or the IC. Hence it is removed. The solution
\[ x = \frac {A k m +M k n +1}{2 k m n} \]
was found not to satisfy the ode or the IC. Hence it is removed.

Summary of solutions found

\begin{align*} x &= \frac {A k m +M k n -\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +\sqrt {\left (A m -M n \right )^{2} k^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n +\sqrt {k^{2} \left (A m -M n \right )^{2} \tanh \left (\frac {k \left (t +c_1 \right ) \left (A m -M n \right )}{2}\right )^{2}}}{2 k m n} \\ x &= \frac {A k m +M k n -\sqrt {k^{2} \left (A m -M n \right )^{2} \tanh \left (\frac {k \left (t +c_2 \right ) \left (A m -M n \right )}{2}\right )^{2}}}{2 k m n} \\ \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 47
ode:=diff(x(t),t) = k*(A-n*x(t))*(M-m*x(t)); 
dsolve(ode,x(t), singsol=all);
 
\[ x = \frac {-A \,{\mathrm e}^{-k \left (c_1 +t \right ) \left (A m -M n \right )}+M}{-{\mathrm e}^{-k \left (c_1 +t \right ) \left (A m -M n \right )} n +m} \]

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
<- separable successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d t}x \left (t \right )=k \left (A -19714 x \left (t \right )\right ) \left (M -m x \left (t \right )\right ) \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & \frac {d}{d t}x \left (t \right ) \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & \frac {d}{d t}x \left (t \right )=k \left (A -19714 x \left (t \right )\right ) \left (M -m x \left (t \right )\right ) \\ \bullet & {} & \textrm {Separate variables}\hspace {3pt} \\ {} & {} & \frac {\frac {d}{d t}x \left (t \right )}{\left (A -19714 x \left (t \right )\right ) \left (M -m x \left (t \right )\right )}=k \\ \bullet & {} & \textrm {Integrate both sides with respect to}\hspace {3pt} t \\ {} & {} & \int \frac {\frac {d}{d t}x \left (t \right )}{\left (A -19714 x \left (t \right )\right ) \left (M -m x \left (t \right )\right )}d t =\int k d t +\mathit {C1} \\ \bullet & {} & \textrm {Evaluate integral}\hspace {3pt} \\ {} & {} & -\frac {\ln \left (M -m x \left (t \right )\right )}{A m -19714 M}+\frac {\ln \left (A -19714 x \left (t \right )\right )}{A m -19714 M}=k t +\mathit {C1} \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} x \left (t \right ) \\ {} & {} & x \left (t \right )=-\frac {-M \,{\mathrm e}^{A k m t +A \mathit {C1} m -19714 M k t -19714 \mathit {C1} M}+A}{-19714+m \,{\mathrm e}^{A k m t +A \mathit {C1} m -19714 M k t -19714 \mathit {C1} M}} \\ \bullet & {} & \textrm {Simplify}\hspace {3pt} \\ {} & {} & x \left (t \right )=\frac {M \,{\mathrm e}^{\left (k t +\mathit {C1} \right ) \left (A m -19714 M \right )}-A}{{\mathrm e}^{\left (k t +\mathit {C1} \right ) \left (A m -19714 M \right )} m -19714} \\ \bullet & {} & \textrm {Redefine the integration constant(s)}\hspace {3pt} \\ {} & {} & x \left (t \right )=\frac {M \mathit {C1} \,{\mathrm e}^{k t \left (A m -19714 M \right )}-A}{\mathit {C1} \,{\mathrm e}^{k t \left (A m -19714 M \right )} m -19714} \end {array} \]
Mathematica. Time used: 2.226 (sec). Leaf size: 82
ode=D[x[t],t]==k*(A-n*x[t])*(M-m*x[t]); 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \frac {A e^{M n (k t+c_1)}-M e^{A m (k t+c_1)}}{n e^{M n (k t+c_1)}-m e^{A m (k t+c_1)}}\\ x(t)&\to \frac {M}{m}\\ x(t)&\to \frac {A}{n} \end{align*}
Sympy. Time used: 0.868 (sec). Leaf size: 49
from sympy import * 
t = symbols("t") 
A = symbols("A") 
M = symbols("M") 
k = symbols("k") 
m = symbols("m") 
n = symbols("n") 
x = Function("x") 
ode = Eq(-k*(A - n*x(t))*(M - m*x(t)) + Derivative(x(t), t),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = \frac {- \frac {A e^{M n \left (C_{1} + k t\right )}}{n} + \frac {M e^{A m \left (C_{1} + k t\right )}}{m}}{e^{A m \left (C_{1} + k t\right )} - e^{M n \left (C_{1} + k t\right )}} \]