I'm trying to the a slope field and some solutions to
$$\frac{dx}{dt}=x^2-4x$$
I was able to get the slope field to plot with:
x,y=var('x','t')
plot_slope_field(x^2-4*x,(t,0,5),(x,-4,8))
I can't figure out how to the solutions to plot. I can get a general solution:
t = var('t')
x = function('x')(t)
f=desolve(diff(x,t) == x^2-4*x,[x,t])
show(f)
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{4} \, \log\left(x\left(t\right) - 4\right) - \frac{1}{4} \, \log\left(x\left(t\right)\right) = C + t$$
If I try it with initial values, say ics=[2,2], I get imaginary solutions:
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{4} \, \log\left(x\left(t\right) - 4\right) - \frac{1}{4} \, \log\left(x\left(t\right)\right) = \frac{1}{4} i \, \pi + t - 2$$
I was able to plot solutions with another windows tool, winplot, but really want to do it in sage. Any clues on how I can do that?