""" The Schur cone, as described in the "Critical angles..." papers by Seeger and Sossa. """ from sage.all import * def is_pointed(P,Q): newP = Cone([ list(p) for p in P ]) newQ = Cone([ list(q) for q in Q ]) return newP.intersection(-newQ).is_trivial() def ext_angles(P,Q): angles = [] for p in P: for q in Q: p = vector(SR, p) q = vector(SR, q) p = p/p.norm() q = q/q.norm() angles.append(arccos(p.inner_product(q))) return angles def schur(n): r""" Return the Schur cone in ``n`` dimensions. INPUT: - ``n`` -- the ambient dimension of the Schur cone and its ambient space. OUTPUT: A rational closed convex Schur cone of dimension ``n``. """ hs = [] for i in range(1,n): h_i = [0]*n h_i[i-1] = QQ(1) h_i[i] = -QQ(1) hs.append(vector(QQ,n,h_i)) return Cone(hs)