Rendering of mathematical expression using Latex markup can be used with Markdown. With some Javascript it can be rendered in Jekyll

Whilst the Latex markup rendered OK with the Markdown editor in VS Code, it did not render as such when the Jekyll site ran. Needed to add the following to the page’s layout html file:

<script type="text/javascript" async
     src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

Some links:

A Simple Example:

$$
E=mc^2
$$

… displays as:
\(E=mc^2\)

Exponents, from the previous post:

$$
10^{-37.303841}  
10^{-2.16881}
$$

Note in this example the braces bracket the exponent .. are needed for more than one digit etc..
… displays as:
\(10^{-37.303841} 10^{-2.16881}\)

A complex example:

$$
J(\theta) = \frac{1}{2m}\sum_{i=1}^{m}(h_\theta(x^{(i)}) - y^{(i)})^2
$$

… diaplays as:

\[J(\theta) = \frac{1}{2m}\sum_{i=1}^{m}(h_\theta(x^{(i)}) - y^{(i)})^2\]

Fractions:

$$
\frac{a}{b} = \frac{numerator}{denominator}
$$

… displays as:
\(\frac{a}{b} = \frac{numerator}{denominator}\)

Subscripts:

$$
H_2O + CO_2
$$

… displays as:
\(H_2O + CO_2\)

Greek Letters

$$
\alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \omega
$$

… displays as:

\[\alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \omega\]

Square Roots

\sqrt{x} + \sqrt[3]{y}

… displays as:

\[\sqrt{x} + \sqrt[3]{y}\]

Conclusion

See the first link above for more examples. This definitely enhances the ability to display mathematical expressions in Markdown.

One more from the second link:

$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$  

… displays as:
\(\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)\)
The Cauchy-Schwarz Inequality

And one more as a request to Chat GPT: “Please provide the Latex markup for the Time-Dependent Schrödinger Wave Equation from Quantum Mechanics?”

$$
i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \left[ -\frac{\hbar^2}{2m} \nabla^2 + V(\mathbf{r}, t) \right] \Psi(\mathbf{r}, t)
$$

… displays as:
\(i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \left[ -\frac{\hbar^2}{2m} \nabla^2 + V(\mathbf{r}, t) \right] \Psi(\mathbf{r}, t)\)
The Time-Dependent Schrödinger Equation


 TopicSubtopic
<  Prev:   Photo Timing Video
   
 This Category Links 
Category:Web Sites Index:Web Sites
<  Prev:   Azure Devops