Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 6 years ago

AndyH gravatar image

plotting autonomous differential equations

I'm trying to the a slope field and some solutions to

dxdt=x24x

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)

14log(x(t)4)14log(x(t))=C+t

If I try it with initial values, say ics=[2,2], I get imaginary solutions:

14log(x(t)4)14log(x(t))=14iπ+t2

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?

plotting autonomous differential equations

I'm trying to the a slope field and some solutions to

dxdt=x24x

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)

14log(x(t)4)14log(x(t))=C+t

If I try it with initial values, say ics=[2,2], I get imaginary solutions:

14log(x(t)4)14log(x(t))=14iπ+t2

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?

plotting autonomous differential equations

I'm trying to plot the a slope field and some solutions to

dxdt=x24x

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)

14log(x(t)4)14log(x(t))=C+t

If I try it with initial values, say ics=[2,2], I get imaginary solutions:

14log(x(t)4)14log(x(t))=14iπ+t2

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?