14

A small, but in my opinion significant, percentage of programming questions (not math questions that'd belong on https://math.stackexchange.com/) and some of their answers require mathematical formulas.

Some mathematical formulas are nearly incomprehensible when approximated in ASCII plain text. Some authors instead use LaTeX code blocks in their posts, but not every one knows how to read those:

$\sigma(M)^2 = \frac{1}{2(M-1)} \sum_{i=1}^{M-1} [y_{i+1}-y_{i}]^2$

(The example is from here.)

Some simple formulas can be approximated by HTML with <sub>, <sup>, &sum; etc. The closest I achieved for the above was

&sigma;(M)<sup> 2</sup> = <sup>1</sup>/<sub>2 (M&minus;1)</sub> &sum;<sub>i=1</sub><sup>M&minus;1</sup> [y<sub>i+1</sub> &minus; y<sub>i</sub>]<sup> 2</sup>

to get

σ(M) 2 = 1/2 (M−1)i=1M−1 [yi+1 − yi] 2

But this can only be taken so far. As soon as matrices or vectors with their components are involved (which can happen for programming questions that do not belong on https://math.stackexchange.com/), this approach breaks down.

Other than on some other Stack Exchange sites, I guess we won't get MathJax on Stack Overflow because it would be a change that could break existing content unless it was strictly opt-in (e.g. with hint comments) and also for performance reasons.

But would it be possible to simply allow posts (at least questions and answers, maybe also comments and tag wikis) to contain MathML markup? For browsers that don't yet support it, one of the available polyfills could be used. If client-side performance is of concern, the polyfill could only be referenced when the Stack Overflow server detects the string <math> in the content (which shouldn't affect server-side performance too much, I think).

4
  • 2
    Aww, the gyrations those mathematicians have to go through to be understood. We can just post a code snippet. Commented Mar 2, 2016 at 23:03
  • @HansPassant Well, sometimes we get question of the pattern: "To compute $formula_A, I've written $code_snippet_B. However, while according to my manual calculation, $formula_A gives result $D for input $C, $code_snipped_B's output for $C is $E. I suspect that $language_F's foo-operator differs from the mathematical foo notion, but can't find any hint toward that in the documentation."
    – das-g
    Commented Mar 2, 2016 at 23:11
  • In my experience, the extent of the mathematical notation that needs to be posted on Stack Overflow can be handled adequately by Unicode characters. How often are you really answering on-topic questions with long mathematical diatribes about matrices and vectors? And how often would it not be better just to express the solution in terms of executable code, which is how the asker will inevitably need to transform your abstract mathematical notation?
    – Cody Gray Mod
    Commented Mar 3, 2016 at 10:26
  • 1
    Yeah, for answers it indeed isn't that important, @CodyGray. But for Questions, expressing what you want to do separately from how you tried it to do can be very useful.
    – das-g
    Commented Mar 3, 2016 at 10:28

1 Answer 1

-5

Users that need to post something in formula form usually have a editor installed that can display those formulas.

An easy alternative to use in questions then, is to make a screenshot of the formula, and to upload that.

This doesn't require an extra client-side library, and is as backwards compatible as it can get.

2
  • 5
    Except for the visually impaired. But I guess it's insensitive to call them "backwards," isn't it? :-)
    – Cody Gray Mod
    Commented Mar 4, 2016 at 16:03
  • 6
    Also, how can others edit a formula when its source format is not in the post's source? This is a workaround, at best.
    – das-g
    Commented Mar 9, 2016 at 12:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .