Saturated Addition
Here's some small talk from board game night this weekend. Consider the following mathematical operation, which I'll call a saturated sum, or saturated addition.
Very nice. Examples:
Questions:
We can lift saturated addition: Lists(ℝ) → ℝ to a multi-dimensional saturated addition Lists(ℝd) → ℝd. Conduct saturated addition component-wise, i.e., in each of the d dimensions, conduct saturated addition separately. You'll get a point in ℝd as final output of the d one-dimensional saturated additions.
This depends on the choice of base of ℝd.
Proof: Consider the two-entry list ((1, 0), (0, 1)) of points in ℝ². The component-wise saturated addition yields (1, 1).
Now we recompute that in a rotated base. First, rotate both list entries counter-clockwise by an eigth. We get the list ((1/√2, 1/√2), (−1/√2, 1/√2)) of rotated points. The component-wise saturated sum is now (0, 1/√2). When we rotate (0, 1/√2) back clockwise by an eigth, it becomes (1/2, 1/2), which fails to match the earlier result (1, 1). End of proof.
Lix physics are on a two-dimensional space, but there is a clear choice of base: the gravity axis and the horizontal axis. It's natural in Lix to depend on this base and not worry about it.
-- Simon
Here's some small talk from board game night this weekend. Consider the following mathematical operation, which I'll call a saturated sum, or saturated addition.
- Input: A finite list (x1, x2, ...) of real numbers. It's okay if the list is empty. Order doesn't matter, but the list is not a set nonetheless: We allow multiple copies of the same number in the list, and it makes a difference.
- Output: A real number.
- Steps:
- If the list is empty, return 0. Otherwise, continue with the next step.
- Compute the sum s of the list, i.e., compute s = x1 + x2 + ...
- Find the maximum max(x1, x2, ...). If the sum s is bigger than this maximum, return this maximum. Otherwise, continue with the next step.
- Find the minimum min(x1, x2, ...). If the sum s is smaller than this minimum, return this minimum. Otherwise, return s.
- If the list is empty, return 0. Otherwise, continue with the next step.
Very nice. Examples:
- The saturated sum of (3, 4, 5) is 5.
- The saturated sum of (20, −1, −2, −3) is 14.
- The saturated sum of the empty list is 0.
- For x fixed, the saturated sum of the nonempty list (x, x, x, ...) is x.
Questions:
- How common is saturated addition? E.g., I would like to use this in Lix to add the speed of overlapping flingers/batters. Where else does this appear?
- We made up the name "saturated addition". Does it have a more canonical name?
In higher dimensions, is component-wise saturated addition base-invariant?No, see below.
We can lift saturated addition: Lists(ℝ) → ℝ to a multi-dimensional saturated addition Lists(ℝd) → ℝd. Conduct saturated addition component-wise, i.e., in each of the d dimensions, conduct saturated addition separately. You'll get a point in ℝd as final output of the d one-dimensional saturated additions.
This depends on the choice of base of ℝd.
Proof: Consider the two-entry list ((1, 0), (0, 1)) of points in ℝ². The component-wise saturated addition yields (1, 1).
Now we recompute that in a rotated base. First, rotate both list entries counter-clockwise by an eigth. We get the list ((1/√2, 1/√2), (−1/√2, 1/√2)) of rotated points. The component-wise saturated sum is now (0, 1/√2). When we rotate (0, 1/√2) back clockwise by an eigth, it becomes (1/2, 1/2), which fails to match the earlier result (1, 1). End of proof.
Lix physics are on a two-dimensional space, but there is a clear choice of base: the gravity axis and the horizontal axis. It's natural in Lix to depend on this base and not worry about it.
-- Simon