Ask Your Question

Revision history [back]

t = var('t')
y = function('y')(t)
ye = desolve(diff(y,t) == 2*10^(-5)*y*(1500-y), y, ics=[0,50])

ye = ye*3/100
yt = solve(ye.simplify_log(), y)
yt

$$ \newcommand{\Bold}[1]{\mathbf{#1}}\left[y\left(t\right) = \frac{1500 e^{\left(\frac{3}{100} t\right)}}{e^{\left(\frac{3}{100} t\right)} + 29}\right] $$

Remark. Here I multiplied by $3/100$, since otherwise the simplify_log() was not factoring the terms containing $y(t)$.

For instance,

f = 2*log(x) - 2*log(x-1)
f.simplify_log()

gives $\log(x^2/(x-1)^2)$, but

f = 1/3*log(x) - 1/3*log(x-1)
f.simplify_log()

gives $-\frac{1}{3}\log(x-1) + \frac{1}{3}\log(x)$, instead of $\frac{1}{3}\log(x/(x-1))$ (and in the first case I would prefer to get rather $2\log(x/(x-1))$; neither factor() nor simplify_full() do it -- why?).

t = var('t')
y = function('y')(t)
ye = desolve(diff(y,t) == 2*10^(-5)*y*(1500-y), y, ics=[0,50])

ye = ye*3/100
yt = solve(ye.simplify_log(), y)
yt

$$ \newcommand{\Bold}[1]{\mathbf{#1}}\left[y\left(t\right) = \frac{1500 e^{\left(\frac{3}{100} t\right)}}{e^{\left(\frac{3}{100} t\right)} + 29}\right] $$

Remark. Here I multiplied by $3/100$, since otherwise the simplify_log() was not factoring the terms containing $y(t)$.

For instance,

f = 2*log(x) - 2*log(x-1)
f.simplify_log()

gives $\log(x^2/(x-1)^2)$, but

f = 1/3*log(x) - 1/3*log(x-1)
f.simplify_log()

gives $-\frac{1}{3}\log(x-1) + \frac{1}{3}\log(x)$, instead of $\frac{1}{3}\log(x/(x-1))$ (and in the first case I would prefer to get rather $2\log(x/(x-1))$; neither factor() nor simplify_full() do it -- why?).