# System of differential equations

Hi! I am doing a project on pursuit curves, and I am trying to plot the system:

de1 = diff(x,t) == 2*(-x)/sqrt(x^2+(t-y)^2)
de2 = diff(y,t) == 2*(t-y)/sqrt(x^2+(t-y)^2)


with x(t) and y(t) being my i and j components for the trajectory a an object.

I wrote:

t = var('t')
x = function('x',t)
y = function('y',t)
de1 = diff(x,t) == 2*(-x)/sqrt(x^2+(t-y)^2)
de2 = diff(y,t) == 2*(t-y)/sqrt(x^2+(t-y)^2)
f,g = desolve_system([de1, de2],[x,y],ics = [0,10,0])
show(f)
show(g)


It gives me a solution for my system, x(t) and y(t) (that I don't understand, since I hacen't seen Laplace), but I can't figure out how to plot the vector equation A(t) = *x(t)i + *y(t)j.

I wanted to use parametric_plot(x(t),y(t),(t,0,20)) but it doesn't work.

Could anyone help me?

Thank you!

edit retag close merge delete

Sort by » oldest newest most voted

You may be better off with a numerical solution.

var('t x y')
F=[2*(-x)/sqrt(x^2+(t-y)^2),2*(t-y)/sqrt(x^2+(t-y)^2)]
ics=[3,10]
times=srange(0,7,0.5)
soln=desolve_odeint(F,ics,times,[x,y])
line(soln)

more

Thank you!

But x and y are not variables, these are the i and j components of my pursuit curve, and they are functions of t. The graph should look a little bit like the one here: http://mathworld.wolfram.com/PursuitCurve.html (http://mathworld.wolfram.com/PursuitC...)

(I'm sorry if you actually have x and y as functions, I am really new to sage.)

x and y are the dependent variables in the differential equations system. They are both functions of t. When you plot x vs. y, you are plotting in the phase plane and this is the graph of $x(t) i +y(t) j$ that you are asking for.