ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 16 Feb 2021 10:14:07 +0100Systematically outputting sign vectors of restricted hyperplane arrangementhttps://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/ I have a way of constructing hyperplane arrangements, which involves taking the restriction of a larger arrangement to one of the hyperplanes in it. I want to output a list of the sign vectors of the regions of this arrangement, where the order of the coordinates in the sign vector corresponds to a specific order I want to impose on the hyperplanes. This has turned out surprisingly tricky, because of a couple of seemingly arbitrary decisions Sage's hyperplane arrangement package makes:
- The hyperplane arrangement constructor seems to not preserve the order of the hyperplanes fed into it, so if I just run the built-in sign_vector method, the coordinates of the resulting vectors may be rearranged from how I want them.
- On the other hand, I'm not sure how to go about manually determining the sign vector, because I'm not sure how Sage decides to coordinatize the hyperplanes in the restricted arrangement. So while I have equations for the hyperplanes in the original ambient space, I'm not sure how I could automatically turn them into equations in the hyperplane I'm restricting to.
Does anyone have advice on how to systematically resolve either of these arbitrary decisions, or how to find a different workaround?Mon, 02 Mar 2020 18:41:23 +0100https://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/Answer by Will Dana for <p>I have a way of constructing hyperplane arrangements, which involves taking the restriction of a larger arrangement to one of the hyperplanes in it. I want to output a list of the sign vectors of the regions of this arrangement, where the order of the coordinates in the sign vector corresponds to a specific order I want to impose on the hyperplanes. This has turned out surprisingly tricky, because of a couple of seemingly arbitrary decisions Sage's hyperplane arrangement package makes:</p>
<ul>
<li>The hyperplane arrangement constructor seems to not preserve the order of the hyperplanes fed into it, so if I just run the built-in sign_vector method, the coordinates of the resulting vectors may be rearranged from how I want them.</li>
<li>On the other hand, I'm not sure how to go about manually determining the sign vector, because I'm not sure how Sage decides to coordinatize the hyperplanes in the restricted arrangement. So while I have equations for the hyperplanes in the original ambient space, I'm not sure how I could automatically turn them into equations in the hyperplane I'm restricting to.</li>
</ul>
<p>Does anyone have advice on how to systematically resolve either of these arbitrary decisions, or how to find a different workaround?</p>
https://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/?answer=50305#post-id-50305Having dug into the source of the arrangements package, I see that the constructor for arrangements sorts the supplied list of hyperplanes, which is what causes the scrambling mentioned in the first bullet point. I believe this will happen both when I construct the arrangement I start with and when I restrict, so I decided it was not worth the trouble of unscrambling these sorting operations.
Instead, I tried to use the workaround of the second bullet point, just using the equations of the hyperplanes (which I know) and evaluating them at representative points of all the regions (which I can delegate to Sage). At this point, it was simpler just to directly work out equations for the hyperplanes in the restriction and construct the actual hyperplane arrangement object from that. For reference, though, the way Sage does this automatically is to choose the variable with the largest coefficient in the equation of the hyperplane H to restrict to (breaking ties by choosing the first such variable) and eliminate that variable from the equations of the other hyperplanes by subtracting off a multiple of the equation of H.Thu, 19 Mar 2020 21:50:10 +0100https://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/?answer=50305#post-id-50305Answer by andreasgrv for <p>I have a way of constructing hyperplane arrangements, which involves taking the restriction of a larger arrangement to one of the hyperplanes in it. I want to output a list of the sign vectors of the regions of this arrangement, where the order of the coordinates in the sign vector corresponds to a specific order I want to impose on the hyperplanes. This has turned out surprisingly tricky, because of a couple of seemingly arbitrary decisions Sage's hyperplane arrangement package makes:</p>
<ul>
<li>The hyperplane arrangement constructor seems to not preserve the order of the hyperplanes fed into it, so if I just run the built-in sign_vector method, the coordinates of the resulting vectors may be rearranged from how I want them.</li>
<li>On the other hand, I'm not sure how to go about manually determining the sign vector, because I'm not sure how Sage decides to coordinatize the hyperplanes in the restricted arrangement. So while I have equations for the hyperplanes in the original ambient space, I'm not sure how I could automatically turn them into equations in the hyperplane I'm restricting to.</li>
</ul>
<p>Does anyone have advice on how to systematically resolve either of these arbitrary decisions, or how to find a different workaround?</p>
https://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/?answer=55730#post-id-55730I also ran into this issue, thank you for the insight!
As far as I could tell there is no general way to backtrack from the internal sorting of the hyperplanes without reimplementing a lot of the internal functionality of the class. Is there a particular reason for sorting the hyperplanes each time an object is constructed?
I'm assuming the line where sorting occurs is here: [https://github.com/sagemath/sage/blob/1da6df404d3ea7ff3019e16ea50d65923c1f4ece/src/sage/geometry/hyperplane_arrangement/arrangement.py#L3485](https://github.com/sagemath/sage/blob/1da6df404d3ea7ff3019e16ea50d65923c1f4ece/src/sage/geometry/hyperplane_arrangement/arrangement.py#L3485)Tue, 16 Feb 2021 10:14:07 +0100https://ask.sagemath.org/question/50139/systematically-outputting-sign-vectors-of-restricted-hyperplane-arrangement/?answer=55730#post-id-55730