from math import sin, cos class beads2d(object): """Vector field that describes the approximation of the Beads problem.""" def __init__(self): pass # Samples the vector field of the Beads problem def sample(self, x, y, t): u = -2 * y + (2 * sin(t)) / 3 v = +2 * x - (2 * cos(t)) / 3 return u, v; # Samples the x-partial of the vector field of the Beads problem def sample_dx(self, x, y, t): u = 0 v = 2 return u, v; # Samples the y-partial of the vector field of the Beads problem def sample_dy(self, x, y, t): u = -2 v = 0 return u, v; # Samples the t-partial of the vector field of the Beads problem def sample_dt(self, x, y, t): u = (2 * cos(t)) / 3 v = (2 * sin(t)) / 3 return u, v;