Python sympy dsolve error
<p>After reinstalling Python, the following simple code</p>

<pre><code>import sympy as sm

x = sm.Symbol('x')

f = sm.Function('f')

y = sm.dsolve(sm.diff(f (x),x)-3*f(x)(1-0.5f(x)),f(x))

print(y)
</code></pre>

<p>gives the following output:</p>

<pre><code>Eq(x + 0.333333333333333*log(1.0*f(x) - 2.0) - 0.333333333333333*log(1.0*f(x)), C1)
</code></pre>

<p>but before it used to give me the right answer:
<code>f(x) == -2.0/(C1*exp(-3.0*x) - 1.0)</code>.</p>

<p>Can someone help me to fix this, please?</p>

<p>You can try to use <code>Rational</code> instead of float number, as follow:</p>

<pre><code>&gt;&gt;&gt; import sympy as sym
&gt;&gt;&gt; x = sym.Symbol('x')
&gt;&gt;&gt; f = sym.Function('f')(x)
&gt;&gt;&gt; y = sym.dsolve(sym.diff(f,x)-3*f*(1-sym.Rational(1, 2)*f),f)
&gt;&gt;&gt; print y
Eq(f(x), -2/(C1*exp(-3*x) - 1))
</code></pre>

python sympy dsolve