- """
-
- def d(j):
- v = [1]*n # Create the list of all ones...
- v[j] = 1 - p # Now "fix" the ``j``th entry.
- return v
-
- V = VectorSpace(QQ, n)
- G = V.basis() + [ d(j) for j in xrange(n) ]
- return Cone(G)
-
-
-def has_rearrangement_property(v, p):
- r"""
- Test if the vector ``v`` has the "rearrangement property."
-
- The rearrangement cone of order ``p`` in `n` dimensions has its
- members vectors of length `n`. The "rearrangement property,"
- satisfied by its elements, is to have its smallest ``p`` components
- sum to a nonnegative number.
-
- We believe that we have a description of the extreme vectors of the
- rearrangement cone: see ``rearrangement_cone()``. This function is
- used to test that conic combinations of those extreme vectors are in
- fact elements of the rearrangement cone. We can't test all conic
- combinations, obviously, but we can test a random one.
-
- To become more sure of the result, generate a bunch of vectors with
- ``random_element()`` and test them with this function.
+ The smallest ``p`` components of every element of the rearrangement
+ cone should sum to a nonnegative number (this tests that the
+ generators really are what we think they are)::
+
+ sage: def _has_rearrangement_property(v,p):
+ ....: return sum( sorted(v)[0:p] ) >= 0
+ sage: all( _has_rearrangement_property(
+ ....: rearrangement_cone(p,n).random_element(),
+ ....: p
+ ....: )
+ ....: for n in range(2, 10)
+ ....: for p in range(1, n-1)
+ ....: )
+ True