From 4caae578d26c89fc8eb1880c750104746cf15b2b Mon Sep 17 00:00:00 2001 From: Killua Zoldyck Date: Mon, 25 Mar 2024 14:52:50 +0800 Subject: [PATCH 1/2] fix: Improve formula presentation --- docs/src/dev/how_it_works.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/src/dev/how_it_works.md b/docs/src/dev/how_it_works.md index fc923d2d..753602e8 100644 --- a/docs/src/dev/how_it_works.md +++ b/docs/src/dev/how_it_works.md @@ -102,24 +102,28 @@ two calls to ``f`` to evaluate the gradient: x_3 \\ x_4 \end{bmatrix} - -\vec{x}_{\epsilon} = \begin{bmatrix} +``` +1st call: +```math +\to \vec{x}_{\epsilon} = \begin{bmatrix} x_1 + \epsilon_1 \\ x_2 + \epsilon_2 \\ x_3 \\ x_4 \end{bmatrix} \to -f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_1} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_2} \epsilon_2 - -\vec{x}_{\epsilon} = \begin{bmatrix} +f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_1} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_2} \epsilon_2, +``` +2nd call: +```math +\to \vec{x}_{\epsilon} = \begin{bmatrix} x_1 \\ x_2 \\ x_3 + \epsilon_1 \\ x_4 + \epsilon_2 \end{bmatrix} \to -f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_3} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_4} \epsilon_2 +f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_3} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_4} \epsilon_2. ``` This seeding process is similar for Jacobians, so we won't rehash it here. From 27b4d09a5101ebe6eb5e13c5f7366bdd8ea7419d Mon Sep 17 00:00:00 2001 From: Killua Zoldyck Date: Mon, 25 Mar 2024 20:43:53 +0800 Subject: [PATCH 2/2] fix: Replace `\to` with `\mapsto` due to the nonstandard meaning of `\to` Co-authored-by: Michael Abbott <32575566+mcabbott@users.noreply.github.com> --- docs/src/dev/how_it_works.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/dev/how_it_works.md b/docs/src/dev/how_it_works.md index 753602e8..bcf1c6bd 100644 --- a/docs/src/dev/how_it_works.md +++ b/docs/src/dev/how_it_works.md @@ -86,7 +86,7 @@ the result. For example, to calculate the partial derivatives for the gradient o \vdots \\ x_N + \epsilon_N \end{bmatrix} -\to +\mapsto f(\vec{x}_{\epsilon}) = f(\vec{x}) + \sum_{i=1}^N \frac{\delta f(\vec{x})}{\delta x_i} \epsilon_i ``` @@ -111,7 +111,7 @@ two calls to ``f`` to evaluate the gradient: x_3 \\ x_4 \end{bmatrix} -\to +\mapsto f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_1} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_2} \epsilon_2, ``` 2nd call: @@ -122,7 +122,7 @@ f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_1} \epsil x_3 + \epsilon_1 \\ x_4 + \epsilon_2 \end{bmatrix} -\to +\mapsto f(\vec{x}_{\epsilon}) = f(\vec{x}) + \frac{\delta f(\vec{x})}{\delta x_3} \epsilon_1 + \frac{\delta f(\vec{x})}{\delta x_4} \epsilon_2. ```