Formule Matematiche
Markdown supporta l'inserimento di formule matematiche tramite la sintassi LaTeX, offrendo capacità di espressione matematica professionale per documenti tecnici, articoli accademici e materiali didattici.
Sintassi Base LaTeX per la Matematica
Formule Inline
Usa il simbolo del dollaro singolo $
per racchiudere le formule:
Questa è una formula inline: $E = mc^2$, che è l'equazione massa-energia di Einstein.
L'area di un cerchio è $A = \pi r^2$, dove $r$ è il raggio.
La soluzione dell'equazione quadratica: $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
Risultato Renderizzato:
Questa è una formula inline: $E = mc^2$, che è l'equazione massa-energia di Einstein.
L'area di un cerchio è $A = \pi r^2$, dove $r$ è il raggio.
La soluzione dell'equazione quadratica: $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
Formule Blocco
Usa il simbolo del dollaro doppio $$
per racchiudere le formule, che verranno visualizzate su una linea separata e centrata:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
$$
\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
$$
$$
\lim_{x \to 0} \frac{\sin x}{x} = 1
$$
Risultato Renderizzato:
$$ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} $$
$$ \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6} $$
$$ \lim_{x \to 0} \frac{\sin x}{x} = 1 $$
Elementi Matematici di Base
Apici e Pedici
<!-- Apici -->
$x^2$, $e^{i\pi}$, $2^{10}$
<!-- Pedici -->
$x_1$, $a_{ij}$, $\log_2 n$
<!-- Combinati -->
$x_1^2$, $a_{i,j}^{(k)}$, $\sum_{i=1}^n x_i^2$
Risultato Renderizzato:
$x^2$, $e^{i\pi}$, $2^{10}$
$x_1$, $a_{ij}$, $\log_2 n$
$x_1^2$, $a_{i,j}^{(k)}$, $\sum_{i=1}^n x_i^2$
Frazioni
<!-- Frazioni base -->
$\frac{1}{2}$, $\frac{a}{b}$, $\frac{x+y}{x-y}$
<!-- Frazioni continue -->
$\frac{1}{1 + \frac{1}{2 + \frac{1}{3 + \cdots}}}$
<!-- Frazioni complesse -->
$\frac{\partial^2 f}{\partial x^2}$, $\frac{d}{dx}\left(\frac{1}{x}\right)$
Risultato Renderizzato:
$\frac{1}{2}$, $\frac{a}{b}$, $\frac{x+y}{x-y}$
$\frac{1}{1 + \frac{1}{2 + \frac{1}{3 + \cdots}}}$
$\frac{\partial^2 f}{\partial x^2}$, $\frac{d}{dx}\left(\frac{1}{x}\right)$
Radici Quadrate
<!-- Radici quadrate -->
$\sqrt{2}$, $\sqrt{x^2 + y^2}$
<!-- Radici n-esime -->
$\sqrt[3]{8}$, $\sqrt[n]{x}$
<!-- Radici complesse -->
$\sqrt{\frac{a}{b}}$, $\sqrt{1 + \sqrt{1 + \sqrt{1 + \cdots}}}$
Risultato Renderizzato:
$\sqrt{2}$, $\sqrt{x^2 + y^2}$
$\sqrt[3]{8}$, $\sqrt[n]{x}$
$\sqrt{\frac{a}{b}}$, $\sqrt{1 + \sqrt{1 + \sqrt{1 + \cdots}}}$
Simboli e Operatori
Lettere Greche
<!-- Lettere greche minuscole -->
$\alpha$, $\beta$, $\gamma$, $\delta$, $\epsilon$, $\zeta$, $\eta$, $\theta$
$\iota$, $\kappa$, $\lambda$, $\mu$, $\nu$, $\xi$, $\pi$, $\rho$
$\sigma$, $\tau$, $\upsilon$, $\phi$, $\chi$, $\psi$, $\omega$
<!-- Lettere greche maiuscole -->
$\Alpha$, $\Beta$, $\Gamma$, $\Delta$, $\Epsilon$, $\Zeta$, $\Eta$, $\Theta$
$\Lambda$, $\Xi$, $\Pi$, $\Sigma$, $\Phi$, $\Psi$, $\Omega$
Risultato Renderizzato:
$\alpha$, $\beta$, $\gamma$, $\delta$, $\epsilon$, $\zeta$, $\eta$, $\theta$
$\iota$, $\kappa$, $\lambda$, $\mu$, $\nu$, $\xi$, $\pi$, $\rho$
$\sigma$, $\tau$, $\upsilon$, $\phi$, $\chi$, $\psi$, $\omega$
$\Alpha$, $\Beta$, $\Gamma$, $\Delta$, $\Epsilon$, $\Zeta$, $\Eta$, $\Theta$
$\Lambda$, $\Xi$, $\Pi$, $\Sigma$, $\Phi$, $\Psi$, $\Omega$
Operatori
<!-- Operazioni base -->
$+$, $-$, $\times$, $\div$, $\pm$, $\mp$
<!-- Operazioni relazionali -->
$=$, $\neq$, $<$, $>$, $\leq$, $\geq$, $\ll$, $\gg$
<!-- Operazioni logiche -->
$\land$, $\lor$, $\lnot$, $\implies$, $\iff$
<!-- Operazioni insiemistiche -->
$\in$, $\notin$, $\subset$, $\supset$, $\cup$, $\cap$, $\emptyset$
<!-- Altri simboli -->
$\infty$, $\partial$, $\nabla$, $\propto$, $\approx$, $\equiv$
Risultato Renderizzato:
$+$, $-$, $\times$, $\div$, $\pm$, $\mp$
$=$, $\neq$, $<$, $>$, $\leq$, $\geq$, $\ll$, $\gg$
$\land$, $\lor$, $\lnot$, $\implies$, $\iff$
$\in$, $\notin$, $\subset$, $\supset$, $\cup$, $\cap$, $\emptyset$
$\infty$, $\partial$, $\nabla$, $\propto$, $\approx$, $\equiv$
Strutture Matematiche Avanzate
Sommatorie e Integrali
<!-- Sommatoria -->
$$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$
$$\sum_{k=0}^{\infty} \frac{x^k}{k!} = e^x$$
<!-- Integrali -->
$$\int_a^b f(x) dx$$
$$\oint_C \mathbf{F} \cdot d\mathbf{r}$$
$$\iint_D f(x,y) \, dx \, dy$$
$$\iiint_V f(x,y,z) \, dx \, dy \, dz$$
<!-- Limiti -->
$$\lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n = e$$
$$\lim_{x \to 0^+} \frac{1}{x} = +\infty$$
Risultato Renderizzato:
$$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$
$$\sum_{k=0}^{\infty} \frac{x^k}{k!} = e^x$$
$$\int_a^b f(x) dx$$
$$\oint_C \mathbf{F} \cdot d\mathbf{r}$$
$$\iint_D f(x,y) , dx , dy$$
$$\iiint_V f(x,y,z) , dx , dy , dz$$
$$\lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n = e$$
$$\lim_{x \to 0^+} \frac{1}{x} = +\infty$$
Matrici e Determinanti
<!-- Matrice base -->
$$
\begin{matrix}
a & b \\
c & d
\end{matrix}
$$
<!-- Matrice con parentesi -->
$$
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
$$
<!-- Determinante -->
$$
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix} = ad - bc
$$
<!-- Sistema di equazioni -->
$$
\begin{cases}
x + y = 1 \\
2x - y = 0
\end{cases}
$$
<!-- Matrice grande -->
$$
\begin{bmatrix}
1 & 0 & \cdots & 0 \\
0 & 1 & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \cdots & 1
\end{bmatrix}
$$
Risultato Renderizzato:
$$ \begin{matrix} a & b \ c & d \end{matrix} $$
$$ \begin{pmatrix} 1 & 2 & 3 \ 4 & 5 & 6 \ 7 & 8 & 9 \end{pmatrix} $$
$$ \begin{vmatrix} a & b \ c & d \end{vmatrix} = ad - bc $$
$$ \begin{cases} x + y = 1 \ 2x - y = 0 \end{cases} $$
$$ \begin{bmatrix} 1 & 0 & \cdots & 0 \ 0 & 1 & \cdots & 0 \ \vdots & \vdots & \ddots & \vdots \ 0 & 0 & \cdots & 1 \end{bmatrix} $$
Formule Multilinea
<!-- Formule multilinea allineate -->
$$
\begin{align}
f(x) &= ax^2 + bx + c \\
&= a(x^2 + \frac{b}{a}x) + c \\
&= a(x + \frac{b}{2a})^2 + c - \frac{b^2}{4a}
\end{align}
$$
<!-- Casi a pezzi -->
$$
f(x) = \begin{cases}
x^2 & \text{se } x \geq 0 \\
-x^2 & \text{se } x < 0
\end{cases}
$$
<!-- Formule numerate -->
$$
E = mc^2 \tag{1}
$$
$$
F = ma \tag{2}
$$
Risultato Renderizzato:
$$ \begin{align} f(x) &= ax^2 + bx + c \ &= a(x^2 + \frac{b}{a}x) + c \ &= a(x + \frac{b}{2a})^2 + c - \frac{b^2}{4a} \end{align} $$
$$ f(x) = \begin{cases} x^2 & \text{se } x \geq 0 \ -x^2 & \text{se } x < 0 \end{cases} $$
$$ E = mc^2 \tag{1} $$
$$ F = ma \tag{2} $$
Font e Stili
Font Matematici
<!-- Grassetto -->
$\mathbf{A}$, $\mathbf{x}$, $\boldsymbol{\alpha}$
<!-- Corsivo (default) -->
$A$, $x$, $\alpha$
<!-- Blackboard bold -->
$\mathbb{R}$, $\mathbb{C}$, $\mathbb{N}$, $\mathbb{Z}$, $\mathbb{Q}$
<!-- Calligrafico -->
$\mathcal{A}$, $\mathcal{B}$, $\mathcal{F}$, $\mathcal{L}$
<!-- Script -->
$\mathscr{A}$, $\mathscr{B}$, $\mathscr{F}$, $\mathscr{L}$
<!-- Monospace -->
$\mathtt{text}$, $\mathtt{ABC}$
<!-- Romano -->
$\mathrm{d}x$, $\mathrm{sin}$, $\mathrm{cos}$
Risultato Renderizzato:
$\mathbf{A}$, $\mathbf{x}$, $\boldsymbol{\alpha}$
$A$, $x$, $\alpha$
$\mathbb{R}$, $\mathbb{C}$, $\mathbb{N}$, $\mathbb{Z}$, $\mathbb{Q}$
$\mathcal{A}$, $\mathcal{B}$, $\mathcal{F}$, $\mathcal{L}$
$\mathscr{A}$, $\mathscr{B}$, $\mathscr{F}$, $\mathscr{L}$
$\mathtt{text}$, $\mathtt{ABC}$
$\mathrm{d}x$, $\mathrm{sin}$, $\mathrm{cos}$
Controllo della Dimensione
<!-- Dimensioni diverse -->
$\tiny{tiny}$ $\small{small}$ $\normalsize{normal}$ $\large{large}$ $\Large{Large}$ $\LARGE{LARGE}$ $\huge{huge}$
<!-- Uso nelle formule -->
$$\Large \sum_{i=1}^{n} \small x_i = \normalsize X$$
Risultato Renderizzato:
$\tiny{tiny}$ $\small{small}$ $\normalsize{normal}$ $\large{large}$ $\Large{Large}$ $\LARGE{LARGE}$ $\huge{huge}$
$$\Large \sum_{i=1}^{n} \small x_i = \normalsize X$$
Simboli e Segni Speciali
Frecce
<!-- Frecce singole -->
$\leftarrow$, $\rightarrow$, $\uparrow$, $\downarrow$
<!-- Frecce doppie -->
$\leftrightarrow$, $\updownarrow$
<!-- Frecce lunghe -->
$\longleftarrow$, $\longrightarrow$, $\longleftrightarrow$
<!-- Frecce a doppia linea -->
$\Leftarrow$, $\Rightarrow$, $\Leftrightarrow$
<!-- Frecce speciali -->
$\mapsto$, $\to$, $\gets$, $\hookrightarrow$, $\leadsto$
Risultato Renderizzato:
$\leftarrow$, $\rightarrow$, $\uparrow$, $\downarrow$
$\leftrightarrow$, $\updownarrow$
$\longleftarrow$, $\longrightarrow$, $\longleftrightarrow$
$\Leftarrow$, $\Rightarrow$, $\Leftrightarrow$
$\mapsto$, $\to$, $\gets$, $\hookrightarrow$, $\leadsto$
Apici e Decorazioni
<!-- Cappello -->
$\hat{a}$, $\widehat{abc}$
<!-- Tilde -->
$\tilde{a}$, $\widetilde{abc}$
<!-- Linea sopra -->
$\bar{a}$, $\overline{abc}$
<!-- Sottolineato -->
$\underline{abc}$
<!-- Freccia vettore -->
$\vec{a}$, $\overrightarrow{AB}$
<!-- Punto -->
$\dot{a}$, $\ddot{a}$, $\dddot{a}$
Risultato Renderizzato:
$\hat{a}$, $\widehat{abc}$
$\tilde{a}$, $\widetilde{abc}$
$\bar{a}$, $\overline{abc}$
$\underline{abc}$
$\vec{a}$, $\overrightarrow{AB}$
$\dot{a}$, $\ddot{a}$, $\dddot{a}$
Esempi di Formule Complesse
Formule di Fisica
<!-- Equazione di Schrödinger -->
$$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
<!-- Equazioni di Maxwell -->
$$
\begin{align}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}
\end{align}
$$
<!-- Trasformazione di Lorentz -->
$$
\begin{pmatrix}
ct' \\
x' \\
y' \\
z'
\end{pmatrix} =
\begin{pmatrix}
\gamma & -\gamma v/c & 0 & 0 \\
-\gamma v/c & \gamma & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
ct \\
x \\
y \\
z
\end{pmatrix}
$$
Risultato Renderizzato:
$$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
$$ \begin{align} \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \ \nabla \cdot \mathbf{B} &= 0 \ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \ \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t} \end{align} $$
$$ \begin{pmatrix} ct' \ x' \ y' \ z' \end{pmatrix} = \begin{pmatrix} \gamma & -\gamma v/c & 0 & 0 \ -\gamma v/c & \gamma & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} ct \ x \ y \ z \end{pmatrix} $$
Teoremi Matematici
<!-- Trasformata di Fourier -->
$$\mathcal{F}\{f(t)\} = F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} dt$$
<!-- Sviluppo di Taylor -->
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
<!-- Formula di Eulero -->
$$e^{i\theta} = \cos\theta + i\sin\theta$$
<!-- Integrale di Gauss -->
$$\int_{-\infty}^{\infty} e^{-ax^2} dx = \sqrt{\frac{\pi}{a}} \quad (a > 0)$$
<!-- Teorema di Bayes -->
$$P(A|B) = \frac{P(B|A)P(A)}{P(B)}$$
Risultato Renderizzato:
$$\mathcal{F}{f(t)} = F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} dt$$
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
$$e^{i\theta} = \cos\theta + i\sin\theta$$
$$\int_{-\infty}^{\infty} e^{-ax^2} dx = \sqrt{\frac{\pi}{a}} \quad (a > 0)$$
$$P(A|B) = \frac{P(B|A)P(A)}{P(B)}$$
Complessità degli Algoritmi
<!-- Complessità temporale -->
$$O(1) < O(\log n) < O(n) < O(n \log n) < O(n^2) < O(2^n) < O(n!)$$
<!-- Relazione di ricorrenza -->
$$T(n) = \begin{cases}
1 & \text{se } n = 1 \\
2T(n/2) + O(n) & \text{se } n > 1
\end{cases}$$
<!-- Teorema principale -->
$$T(n) = aT(n/b) + f(n)$$
Dove $a \geq 1$, $b > 1$, $f(n)$ è una funzione asintoticamente positiva.
Risultato Renderizzato:
$$O(1) < O(\log n) < O(n) < O(n \log n) < O(n^2) < O(2^n) < O(n!)$$
$$T(n) = \begin{cases} 1 & \text{se } n = 1 \ 2T(n/2) + O(n) & \text{se } n > 1 \end{cases}$$
$$T(n) = aT(n/b) + f(n)$$ Dove $a \geq 1$, $b > 1$, $f(n)$ è una funzione asintoticamente positiva.
Buone Pratiche per le Formule Matematiche
Suggerimenti di Scrittura
✅ Consigliato:
1. **Usa comandi semantici**:
- Usa `\sin`, `\cos`, `\log` invece di `sin`, `cos`, `log`
- Usa `\mathrm{d}x` per i differenziali
2. **Mantieni spaziatura ragionevole**:
- Aggiungi spazi appropriati attorno agli operatori: `\,` (spazio sottile), `\;` (spazio medio), `\quad` (spazio grande)
3. **Usa parentesi abbinate**:
- Dimensionamento automatico: `\left(\right)`, `\left[\right]`, `\left\{\right\}`
4. **Allinea le formule**:
- Usa l'ambiente `align` per allineare i segni di uguale
- Usa `&` per marcare i punti di allineamento
❌ Evita:
1. Non andare a capo nelle formule lunghe
2. Mancanza di parentesi necessarie
3. Uso incoerente dei simboli
4. Ignorare il controllo degli errori di sintassi
Correzioni di Errori Comuni
<!-- ❌ Errato -->
$sin(x)$, $log(x)$, $max(a,b)$
<!-- ✅ Corretto -->
$\sin(x)$, $\log(x)$, $\max(a,b)$
<!-- ❌ Errato -->
$(\frac{a}{b})$
<!-- ✅ Corretto -->
$\left(\frac{a}{b}\right)$
<!-- ❌ Errato -->
$x=1+2+3+...+n$
<!-- ✅ Corretto -->
$x = 1 + 2 + 3 + \cdots + n$
Considerazioni sull'Accessibilità
Per migliorare l'accessibilità delle formule:
1. **Aggiungi descrizioni testuali**:
$$E = mc^2$$
> Questa è l'equazione massa-energia di Einstein, significa che l'energia è uguale alla massa per la velocità della luce al quadrato.
2. **Usa testo alternativo**:
Aggiungi spiegazioni semplificate dopo formule complesse
3. **Evita di usare solo il colore per distinguere**:
Usa simboli o stili diversi per distinguere i concetti
4. **Mantieni le formule concise**:
Suddividi formule complesse in più passaggi
Ambienti Matematici Supportati
Supporto dei Processor Markdown
Processore | Supporto Matematica | Sintassi | Configurazione |
---|---|---|---|
GitHub | ✅ | $...$ , $$...$$ | Automatico |
GitLab | ✅ | $...$ , $$...$$ | Da abilitare |
VitePress | ✅ | $...$ , $$...$$ | Configurazione plugin |
Jekyll | ✅ | $...$ , $$...$$ | MathJax/KaTeX |
Hugo | ✅ | $...$ , $$...$$ | Supporto tema |
Esempio di Configurazione VitePress
// .vitepress/config.js
export default {
markdown: {
math: true
}
}
Motori di Rendering
Motori comuni per il rendering delle formule matematiche:
1. **MathJax**:
- Il più completo, supporta tutto LaTeX
- Alta qualità di rendering, ma caricamento più lento
2. **KaTeX**:
- Rendering veloce
- Supporta la sintassi matematica più comune
- Dimensioni ridotte
3. **MathML**:
- Supporto nativo del browser
- Sintassi complessa, di solito generata automaticamente
Sintassi Correlata
- Incorporamento HTML - Miglioramenti HTML
- Diagrammi - Disegno grafici
- Best Practices - Raccomandazioni di scrittura
Strumenti e Risorse
Editor Online
- LaTeX Live: Anteprima in tempo reale delle formule LaTeX
- MathJax Demo: Test rendering MathJax
- KaTeX Demo: Test formule KaTeX
- Desmos: Espressioni matematiche grafiche
Strumenti di Modifica delle Formule
- MathType: Editor professionale di formule matematiche
- LaTeX Workshop (VS Code): Plugin per la scrittura LaTeX
- MathQuill: Editor matematico visuale
- Wiris: Editor online di formule matematiche
Risorse di Riferimento
- Simboli Matematici LaTeX: Tabella di riferimento dei simboli matematici
- Detexify: Riconoscimento simboli LaTeX scritti a mano
- Documentazione MathJax: Documentazione ufficiale
- Funzioni Supportate KaTeX: Elenco delle funzioni supportate
Padroneggiando la sintassi delle formule matematiche, puoi esprimere elegantemente concetti e formule matematiche complesse nella documentazione tecnica.