三個著名的數學公式
| 先決條件 | 在嘗試此評估之前,您應該已經完成了本模組中的所有文章,並且還應該瞭解 HTML 基礎知識(學習 HTML 簡介)。 |
|---|---|
| 目標 | 嘗試使用一些 MathML 並測試您新學到的知識。 |
一篇簡短的數學文章
目標是使用 HTML 和 MathML 重寫以下數學文章
雖然您不需要熟悉 LaTeX,但瞭解生成它的 LaTeX 原始碼可能會有用。
latex
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
To solve the cubic equation $t^3 + pt + q = 0$ (where the real numbers
$p, q$ satisfy ${4p^3 + 27q^2} > 0$) one can use Cardano's formula:
\[
\sqrt[{3}]{
-\frac{q}{2}
+\sqrt{\frac{q^2}{4} + {\frac{p^{3}}{27}}}
}+
\sqrt[{3}]{
-\frac{q}{2}
-\sqrt{\frac{q^2}{4} + {\frac{p^{3}}{27}}}
}
\]
For any $u_1, \dots, u_n \in \mathbb{C}$ and
$v_1, \dots, v_n \in \mathbb{C}$, the Cauchy–Bunyakovsky–Schwarz
inequality can be written as follows:
\[
\left| \sum_{k=1}^n {u_k \bar{v_k}} \right|^2
\leq
{
\left( \sum_{k=1}^n {|u_k|} \right)^2
\left( \sum_{k=1}^n {|v_k|} \right)^2
}
\]
Finally, the determinant of a Vandermonde matrix can be calculated
using the following expression:
\[
\begin{vmatrix}
1 & x_1 & x_1^2 & \dots & x_1^{n-1} \\
1 & x_2 & x_2^2 & \dots & x_2^{n-1} \\
1 & x_3 & x_3^2 & \dots & x_3^{n-1} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1 & x_n & x_n^2 & \dots & x_n^{n-1} \\
\end{vmatrix}
= {\prod_{1 \leq {i,j} \leq n} {(x_i - x_j)}}
\]
\end{document}
起點
要開始此評估,您可以依靠我們常用的 HTML 模板。預設情況下,它使用 UTF-8 編碼,為 <body> 和 <math> 標籤使用特殊的 Web 字型(與 LaTeX 輸出的外觀和感覺相似)。目標是用實際的 MathML 內容替換問號 ???。
html
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>Three famous mathematical formulas</title>
<link
rel="stylesheet"
href="https://fred-wang.github.io/MathFonts/LatinModern/mathfonts.css" />
</head>
<body class="htmlmathparagraph">
<p>
To solve the cubic equation ??? (where the real numbers ??? satisfy ???)
one can use Cardano's formula: ???
</p>
<p>
For any ??? and ???, the Cauchy–Bunyakovsky–Schwarz inequality can be
written as follows: ???
</p>
<p>
Finally, the determinant of a Vandermonde matrix can be calculated using
the following expression: ???
</p>
</body>
</html>
提示和技巧
- 首先插入空的
<math>標籤,並決定它們是否應該具有display="block"屬性。 - 檢查使用的文字並查詢其 Unicode 字元(“−”, “ℂ”, “∑”,...)。
- 分析文字的每個部分的語義(變數?運算子?數字?),並確定每個部分使用的適當標記元素。
- 尋找高階結構(分數?根?指令碼?矩陣?)並確定每個結構使用的適當 MathML 元素。
- 不要忘記依靠
<mrow>來對子表示式進行分組。 - 注意可伸縮運算子和大型運算子!
- 使用 W3C 驗證器 來捕獲 HTML/MathML 標記中的意外錯誤。
- 如果您卡住了,或者意識到手動編寫 MathML 是多麼痛苦,請隨時使用工具來幫助 編寫 MathML,例如 TeXZilla。