# Revision history [back]

The following function allows you to move the initial point and determines the "corners" of the picture with respect to the maximum an minimum values of the solutions.

@interact
def syst(x0=slider(-2,2,0.1,0.5),y0=slider(-2,2,0.1,0.5)):
x,y=var('x y')
vect=[y,-x]
sol=desolve_odeint(vect,[x0,y0],srange(-4,4,0.1),[x,y])
xmin=sol[0,0]
xmax=sol[0,0]
ymin=sol[0,1]
ymax=sol[0,1]
for i in range(0,len(sol)):
if sol[i,0] > xmax:
xmax=sol[i,0]
if sol[i,0]< xmin:
xmin=sol[i,0]
for i in range(0,len(sol)):
if sol[i,1] > ymax:
ymax=sol[i,0]
if sol[i,1]< ymin:
ymin=sol[i,0]
p1=plot_vector_field((vect[0],vect[1]),(x,xmin-2,xmax+2),(y,ymin-2,ymax+2),plot_points=60)
p=line(zip(sol[:,0],sol[:,1]))
(p+p1).show(aspect_ratio=1)


The following function allows you to move the initial point and determines the "corners" of the picture with respect to the maximum an minimum values of the solutions.

@interact
def syst(x0=slider(-2,2,0.1,0.5),y0=slider(-2,2,0.1,0.5)):
x,y=var('x y')
vect=[y,-x]
sol=desolve_odeint(vect,[x0,y0],srange(-4,4,0.1),[x,y])
xmin=sol[0,0]
xmax=sol[0,0]
ymin=sol[0,1]
ymax=sol[0,1]
for i in range(0,len(sol)):
if sol[i,0] > xmax:
xmax=sol[i,0]
if sol[i,0]< xmin:
xmin=sol[i,0]
for i in range(0,len(sol)):
if sol[i,1] > ymax:
ymax=sol[i,0]
if sol[i,1]< ymin:
ymin=sol[i,0]
p1=plot_vector_field((vect[0],vect[1]),(x,xmin-2,xmax+2),(y,ymin-2,ymax+2),plot_points=60)
p=line(zip(sol[:,0],sol[:,1]))
(p+p1).show(aspect_ratio=1)


Of course the solution using maxima is the nicest.

The following function allows you to move the initial point and determines the "corners" of the picture with respect to the maximum an minimum values of the solutions.

@interact
def syst(x0=slider(-2,2,0.1,0.5),y0=slider(-2,2,0.1,0.5)):
x,y=var('x y')
vect=[y,-x]
vect=[-y,-x]
sol=desolve_odeint(vect,[x0,y0],srange(-4,4,0.1),[x,y])
xmin=sol[0,0]
xmax=sol[0,0]
ymin=sol[0,1]
ymax=sol[0,1]
for i in range(0,len(sol)):
if sol[i,0] > xmax:
xmax=sol[i,0]
if sol[i,0]< xmin:
xmin=sol[i,0]
for i in range(0,len(sol)):
if sol[i,1] > ymax:
ymax=sol[i,0]
if sol[i,1]< ymin:
ymin=sol[i,0]
p1=plot_vector_field((vect[0],vect[1]),(x,xmin-2,xmax+2),(y,ymin-2,ymax+2),plot_points=60)
p=line(zip(sol[:,0],sol[:,1]))
(p+p1).show(aspect_ratio=1)


Of course the solution using maxima is the nicest.