Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
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'))