Wikipedia:Reference desk/Archives/Mathematics/2008 August 3

= August 3 =

Markup syntax for a mathematical sequence and \lbrace \rbrace not documented
I was trying to edit markup syntax for a mathematical sequence containing braces {a_i} i.e. this syntax: $${a_i}$$

The braces kept getting silently suppressed when appearing inside the math markup tag. Yes I know that in general outside math tag, (double-)braces would signify a Wikipedia reference; but inside the math tag, that has no meaning, hence braces should be treated as normal characters (or else, rejected and flagged).

I checked the Editing help and Reference and eventuallly deep down after much hunting I found the correct syntax is http://en.wikipedia.org/wiki/Help:Formula#Parenthesizing_big_expressions.2C_brackets.2C_bars i.e. you still need to use lbrace rbrace inside math tag even though that's meaningless. This is not well documented, such documentation as is is buried, and the fact that braces are silently suppressed is also bad.

Suggestions: Insert: – — … ‘ “ ’ ” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → ·
 * add \lbrace \rbrace to the standard Editing Insert bar
 * have the markup editor detect and flag braces {} inside a math (or other) markup tag and suggest 'you probably meant \lbrace \rbrace ?'
 * document this more prominently, with examples

Smcinerney (talk) 12:31, 3 August 2008 (UTC)
 * This is documented on the page documenting Wikipedia's implementation of TeX. Where else do you think it should be documented? As indicated at Help:Displaying a formula, you don't actually need \lbrace \rbrace, you can just escape them with backslashes, thus: $$\{a_i\}$$. It would be a very bad idea to warn people using braces in TeX, since the reason they need to be escaped is there importance in TeX markup, e.g. $$\frac{1}{2}$$ produces $$\frac{1}{2}$$. Algebraist 12:47, 3 August 2008 (UTC)
 * Braces are necessary in $$ \frac{11+1} 2 $$ displaying $$ \frac{11+1} 2 $$ while $$ \frac 11+1 2 $$ displays $$ \frac 11+1 2 $$. Braces are displayed in $$ \{11+1\} $$ : $$ \{11+1\} $$ but not in $$ {11+1} $$ : $$ {11+1} $$. Bo Jacoby (talk) 13:58, 3 August 2008 (UTC).

But you also need to use \left\{ and \right\} to allow the braces to grow to the size of the expression between them. Michael Hardy (talk) 16:29, 4 August 2008 (UTC)

My comment was about the editing process, as experienced by a newbie user (e.g. me). Your first instinct is to use raw braces\{\}. Then, you realise they're silently suppressed. But when you look at the Insert bar for special symbols, all you see is: Insert: – — … ‘ “ ’ ” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · and below it you see Symbols: ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶  # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞   ‘ “ ’ ” «»   ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥   ♠ ♣ ♥ ♦  m² m³ You might typically take this to imply that braces are not special symbols. The Insert and Symbols bars certainly have odd and rare selections, since braces are going to be far more common than (say) '≈' or '§' or '№'. Hence I'm suggesting braces should be added on the Insert bar.

Please replicate this exercise for yourselves - just go take a look at the Insert and Symbols bars as shown to an editing user. This is not user-friendly.

Also, I'm saying it is seriously Bad News that the editor silently strips out braces inside a math tag without saying something like 'Braces stripped from math tag - did you mean to use \{\} ?' How else would a user become aware that (single) braces are treated specially?

Algebraist - it would not be hard to automatically distinguish between braces occurring inside a math tag but not part of a TeX expression like \frac, e.g. my $$ {a_k} $$ example, and your TeX expression example where they are part. (If you disagree, can you show a counterexample?)

[I was not aware of the alternative \left\{ syntax instead of \lbrace which Michael H shows.] But the various syntaxes for braces need to be more accessible from the editing page - which they currently aren't. How do you propose this might be done? Smcinerney (talk) 17:11, 4 August 2008 (UTC)

It is not apparent from the Editing Help that everything inside a tag will have single-braces stripped since it must be TeX. Please reread the Editing Help and verify for yourself that that connection isn't made. You won't get far until you learn this. You won't get far in teaching people this, unless you actually document it in the relevant place - which it currently isn't - which was my issue. The "Symbols" list you mention shouldn't even be used if you're entering an expression using $$$$ tags, since there are TeX equivalents for those symbols. Again, how on earth could anyone be expected to know that, based on the Editing Help? again this is not documented, and needs to be. Currently you can freely click on Symbols and insert them inside TeX - which is undesirable. ''A separate cheat-sheet below the edit box, containing commonly used TeX keywords... maybe.'' I emphatically second that thought. At minimum, how to clearly document (on the Editing Help page, not buried deep in the TeX documentation) that normal markup doesn't apply inside tags? As per Oliphaunt's suggestion, at minimum some link that says "the contents of tags require TeX syntax".
 * Your problem is in the phrase "inside a math tag bot not part of a TeX expression". Everything inside $$$$ is a TeX expression. Once you've entered that math tag, you're now required to write in TeX. One of the basic syntactical features of TeX is that unescaped braces are used for grouping and do not appear as braces in the output. You won't get far until you learn this. You might as well ask for a "warning" whenever a caret appears in the math exprsesion.... "Warning: you used a caret. Because it means something in TeX (superscript) it will not be appear as a caret in the output!"
 * The "Symbols" list you mention shouldn't even be used if you're entering an expression using $$$$ tags, since there are TeX equivalents for those symbols.
 * A separate cheat-sheet below the edit box, containing commonly used TeX keywords... maybe. And as long as we're making unreasonable demands, I'd rather use eqn --tcsetattr (talk / contribs) 20:07, 4 August 2008 (UTC)

And as long as we're making unreasonable demands I very strongly object to your tone.

So, what is our consensus on what needs documenting and where?Smcinerney (talk) 00:55, 6 August 2008 (UTC)


 * I'm not sure which help pages you're referring to. Help:Editing doesn't mention math at all, so you couldn't have learned that the tag exists if that was the only help page you read. If you looked at Help:Math (also known as Help:Displaying a formula, Help:Formula and a bunch of other names), the first thing it says is "MediaWiki uses a subset of TeX markup"; a bit later, under "Syntax", it says "Math markup goes inside $$ ... $$ "; perhaps it would be better to change the words "Math markup" to "TeX markup" there but TeX is mentioned several times in the next few sentences so it's not exactly deeply hidden. If there are any other help pages that mention the  tag but don't also mention TeX, tell us where they are. --tcsetattr (talk / contribs) 05:12, 6 August 2008 (UTC)


 * I don't think it would be easy to tell when the braces were intended to be literal. I can't give a counter example unless you give a method of telling, though. If you give provide an algorithm for distinguishing, then I'll try and find an example that it doesn't work for (if I can't, I'll implement it for you!). --Tango (talk) 04:21, 5 August 2008 (UTC)
 * How about the simple 'Raw braces are illegal inside tags unless associated with a TeX operator'? (Hence if they occur without any operator, that is always obviously wrong)Smcinerney (talk) 00:57, 6 August 2008 (UTC)

To respond to the suggestions of improving this made by the original poster, the only viable option is to "document this more prominently, with examples". tags are a bit of a specialist thing, in that they require knowledge of TeX, whereas standard wiki syntax doesn't. However, I don't quite see how the documentation can be improved to help here. TeX just has a lot of features, resulting in a long page at WP:MATH. Oliphaunt (talk) 10:58, 5 August 2008 (UTC)

Derivative of the generalized factorial function.
Yes, the generalized factorial function, extended to all complex numbers (validly) by Euler, save for negative integers. But, just to keep the convoluting complex analysis stuff out, let's consider the factorial function x! extended to all real numbers save for negative integers.

Now, I propose, as I'm sure some other people have, that:

d/dx(x!) = ∫ e^(-t) * ln(t) * t^x dt

with lower and upper limits 0 and infinity, respectively. Confirm/deny? I was just playing around with the limit definition and reached that. Point out any errors I may have made, if that's okay. —Preceding unsigned comment added by 124.191.116.239 (talk) 14:51, 3 August 2008 (UTC)
 * The generalized factorial function is normally called the gamma function. Your formula is equivalent to the formula for the derivative of gamma in that article. Algebraist 15:26, 3 August 2008 (UTC)