1 | r""" |
---|
2 | |
---|
3 | sage: import scipy |
---|
4 | sage: from scipy import integrate |
---|
5 | sage: t = srange(0, 40, 0.1) |
---|
6 | sage: n = 35 |
---|
7 | sage: CI_cart = [[4, .2 * i] for i in range(n)] |
---|
8 | sage: CI = map(lambda x:[sqrt(x[0]**2+x[1]**2),\ |
---|
9 | ... pi - arctan(x[1] / x[0])], CI_cart) |
---|
10 | sage: alpha = [0.1, 0.5, 1, 1.25] |
---|
11 | sage: for a in alpha: # long time |
---|
12 | ... dX_dt = lambda X, t=0: [cos(X[1])*(1-1/X[0]^2), \ |
---|
13 | ... -sin(X[1]) * (1/X[0]+1/X[0]^3) + 2*a/X[0]^2] |
---|
14 | ... q = circle((0, 0), 1, fill=True, rgbcolor='purple') |
---|
15 | ... for j in range(n): |
---|
16 | ... X = integrate.odeint(dX_dt, CI[j], t) |
---|
17 | ... Y = [[u[0] * cos(u[1]), u[0] * sin(u[1])] for u in X] |
---|
18 | ... q += line(Y, xmin = -4, xmax = 4, color='blue') |
---|
19 | ... q.show(aspect_ratio = 1, axes = False) |
---|
20 | ... |
---|
21 | |
---|
22 | """ |
---|