Hello all,

I'm trying to display a trajectory in two dimensions. The points are
angles, thus I'd like to make use of ``RDF.restric_angle``.

However, when I plot the trajectory, the part with negative
coordinates is missing. It seems like a bug to me, but I just
discovered ``RDF.restric_angle``, so I may be misusing it.

The code is at the end of the message, and published on this notebook too:
http://www.sagenb.org/home/pub/2411

Thank you for any help !

Regards
Sebastien

def mod2pi(q):
    return vector((RDF(q[0]).restrict_angle(),
                   RDF(q[1]).restrict_angle()))
# create a piecewise affine trajectory
n = 100
q0 = vector((0, 0))
q1 = vector((0, pi/4))
q2 = vector((pi/4, pi/4))
q3 = q2 + vector((4*pi, 4*pi))
traj = [q0+(q1-q0)*t/n for t in range(n)]
traj += [q1+(q2-q1)*t/n for t in range(n)]
traj += [q2+(q3-q2)*t/n for t in range(n)]
# the same, restricted to ]-pi, pi]
traj_mod = [mod2pi(q) for q in traj]
# For some reason, ``line`` doesn't display the negative points of ``traj_mod``
show(line(traj, color='green') + line(traj_mod, color='red') +
point(traj_mod[290], color='blue'))

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to