Search code examples
githubmarkdownmathematical-expressions

Writing mathematical expression with numerator and denominator in markdown github


I want to write the next expression in readme.md file in my github repository :

enter image description here

Unfortunately, I could not get the right formula. I have tried the next expression :

$$R^2= 1 - {MSE\over Var(y)}= 1- { \sum_{i=1}^{n} ( y_i - \hat{y}_{i} )^2 } \over { \sum_{i=1}^{n}{ (y_i- \overline {y})^2} } }$$

I pretty sure that the problem is in the second sum means sum in the denominator

However, I got the next expression:

enter image description here


Solution

  • MathJax 3.2.0 (which is the version GitHub currently uses for math rendering) seems to glitch on that particular expression. It seems to be fixed in the latest MathJax version (3.2.2), so one option is to wait for GitHub to upgrade.

    Alternatively, it works without the sum indices:

    $$R^2= 1 - {MSE\over Var(y)}= 1- {{ \sum( y_i - \hat{y}_{i} )^2 } \over { \sum{ (y_i- \overline {y})^2} }}$$
    

    enter image description here