Hacker News new | ask | show | jobs
by yig 1240 days ago
It's not common to close that brace when writing math. (I've not seen it.)
2 comments

Ah, right, I see now what is is, I was confused.

Another thing I find confusing are the braces around ℤ × ℤ. They seem to be unnecessary (it wouldn’t make much sense for ∈ to have higher precedence than ×), and/or would imply a singleton set containing the set ℤ × ℤ as its only element.

I wonder whether adding a brace for each row would clarify the notation, by more closely resembling a single multi-line brace:

  A_ij = { 1 if (i,j) ∈ E
         { 0 otherwise
  where
  A ∈ ℝ^(n × n)
  E ∈ { ℤ × ℤ }
  n ∈ ℤ
I like this. I created a GitHub issue: https://github.com/iheartla/iheartla/issues/138
If they want it to look like actual math notation, they might as well:

  A_ij = ⎰ 1 if (i,j) ∈ E
         ⎱ 0 otherwise
  where
  A ∈ ℝ^(n × n)
  E ∈ { ℤ × ℤ }
  n ∈ ℤ
Unicode actually has semantic symbols that could be used for a nicer 2D monospaced layout here, such as ⎧ ⎪ ⎨ ⎩ ( (LEFT CURLY BRACKET UPPER HOOK, MIDDLE PIECE, LOWER HOOK, and CURLY BRACKET EXTENSION). With more conditional rows, you could use these. One downside is that you would have to do a 2D parse, since the = wouldn't be on the first line. We've been loath to go there. It also seems painful as a user to have to type all the right bracket symbols in all the right places.

We do support the Unicode ⎡|⎦ symbols for matrices. The grammar is that a matrix starts with either [ or ⎡ and ends with either ] or ⎦. Rows can be optionally surrounded by |. I find this too cumbersome to use myself.

I'm aware of those. The symbols I used are also semantic, for the special case of 2-row tall braces.
Ah, I didn't realize. I guess that would work for the case of 2-row tall statements.
Why not use the haskell guard syntax?

  A_ij = | 1 if (i,j) ∈ E
         | 0 otherwise
  where
  A ∈ ℝ^(n × n)
  E ∈ { ℤ × ℤ }
  n ∈ ℤ
I (speaking as a designer of I Heart LA empathizing with a user) wouldn't have thought to use that character as an approximation of {.