## Chapter 6 - exercise 29
## attach("nonl-u29.py")
var('x y')
F = y
G = x - x*x
[x0,x1]=[-1,2]
[y0,y1]=[-1,1]
## prime integral
v1 = y*y/2 + x**3/3 - x**2/2
## plot levelset {v1=0} (homoclinic orbit)
V = implicit_plot( v1 , (x,x0,x1), (y,y0,y1), color='blue' ,
linewidth = 1 )
S = streamline_plot( (F,G) , (x,x0,x1), (y,y0,y1), color='black',
density=2 , linewidth=0.3 )
P = S + V
P.show(axes=1,aspect_ratio=1,figsize=10)
#P.save("uloha29.png",axes=1)