Differential equation in chemical reaction application

95 Views Asked by At

I need help in solving this ivp differential equation

$$\frac{dx}{dt} = k(a-x)^2 (b-\frac{x}{2})$$

$a=0.0010$

$b =0.0041$

$k=7.13x10^3$

with ivp $x(0) = 0$

by python solution, the answer should be

enter image description here

by manually solve the equation before substitute it with ivp, i get this

enter image description here

Am I on the right track, because if I replace with the ivp value, $x(0)=0$ to get C value, I get different answer as python

I'm stuck in solving this, any help will be appreciated!

1

There are 1 best solutions below

0
On

As

$$\frac{dx}{dt} = k(a-x)^2 \left(b-\frac{x}{2}\right)$$

is separable we have

$$ -\frac{2 ((a-x) \log (x-2 b)+(x-a) \log (x-a)+a-2 b)}{k (a-2 b)^2 (a-x)}=t+c_0 $$

or

$$ \frac{1}{2} k (a-2 b)^2 (t+c_0)+\frac{a-2 b}{a-x}-\log (x-a)+\log (x-2 b)=0 $$

or

$$ e^{\frac{a-2 b}{a-x}}\frac{x-2b}{x-a}-e^{-\frac{1}{2} k (a-2 b)^2 (t+c_0)}=0 $$

now making $(t=0, x=0)$ we have

$$ e^{\frac{a-2 b}{a}}\frac{2b}{a}-e^{-\frac{1}{2} k (a-2 b)^2 c_0}=0 $$

so

$$ c_0 = \frac{2 \log \left(\frac{a e^{\frac{2 b}{a}-1}}{2 b}\right)}{k (a-2 b)^2} $$