A scientific note becomes easier to follow when its assumptions, equations, examples, and sources have distinct roles. Here is a small worked example: estimating the derivative of using a forward difference.

The numbers are calculated examples, not experimental measurements. Each source block can be copied into another article; the rendered material below it shows the result.

Choose the notation packages

Core MathJax notation supports fractions, sums, matrices, and document-local macros. This article also enables optional STEM packages in its frontmatter:

yaml
math:
packages: [physics, mathtools, units, mhchem, cancel]

In Studio, the same choices live in article Settings → Mathematics. Enable only what the article uses. Physics changes some commands: \div means divergence, while \divsymbol supplies the familiar division sign.

State the definition before using it

A derivative describes a local rate of change; a difference quotient estimates that rate using a nonzero step. The limiting definition and its geometric interpretation are introduced in [1]. Our example below studies the finite-step error directly.

markdown
:::definition[Forward difference]{#def-forward}
For $h>0$, define $D_h f(x) = \frac{f(x+h)-f(x)}{h}$.
:::

Definition 1 · Forward difference

For , define .

The label def-forward is a stable reference target. Its displayed number is assigned automatically, so adding an earlier statement does not require rewriting every reference.

Build a short argument

The statement components share a document-local counter. Choose the name that matches the role of the statement; numbering alone does not establish that a claim has been proved.

markdown
:::lemma[Increment of a square]{#lem-increment}
For real $x,h$, $(x+h)^2-x^2=2xh+h^2$.
:::
:::proof[Proof of the increment identity]
Expand $(x+h)^2=x^2+2xh+h^2$ and subtract $x^2$.
:::
:::theorem[Exact forward-difference error]{#thm-error}
For $f(x)=x^2$ and $h>0$, $D_h f(x)-f'(x)=h$.
:::

Lemma 2 · Increment of a square

For real , .

Proof of the increment identity

Expand and subtract .

∎

Theorem 3 · Exact forward-difference error

For and , .

Proof of the error formula

By Lemma 2, . Since , subtracting the derivative leaves .

∎

Other statement names express different parts of the same argument:

markdown
:::proposition[Smaller positive steps]{#prop-smaller}
If $0<h_1<h_2$, the absolute error for $h_1$ is smaller than for $h_2$.
:::
:::corollary[Halving the step]{#cor-half}
Replacing $h$ with $h/2$ halves the error for this function in exact arithmetic.
:::
:::example[A concrete evaluation]{#ex-quarter}
At $x=1$ and $h=1/4$, $D_h f(1)=2.25$, whereas $f'(1)=2$.
:::

Proposition 4 · Smaller positive steps

If , the absolute error for is smaller than for .

Corollary 5 · Halving the step

Replacing with halves the error for this function in exact arithmetic.

Example 6 · A concrete evaluation

At and , , whereas .

Both Proposition 4 and Corollary 5 follow immediately from Theorem 3. This is a claim about a particular polynomial and exact arithmetic, not a general promise that arbitrarily small floating-point steps always improve a numerical derivative.1

Number a derivation as one equation

An equation container holds exactly one display equation. Put several related lines inside aligned to keep them together.

markdown
:::equation[Forward difference of a square]{#eq-forward}
$$
\begin{aligned}
D_h f(x)
&= \frac{(x+h)^2-x^2}{h} \\
&= \frac{2xh+h^2}{h} \\
&= 2x+h.
\end{aligned}
$$
:::
The finite-step term is visible in :ref[eq-forward].
(1)
Forward difference of a square

The finite-step term is visible in Equation 1. Notice that the reference stays readable without manually inserting an equation number.

Compare exact values in a table

Use a captioned table when the values need a label, a note, or a cross-reference. Alignment comes from the ordinary GFM delimiter row.

markdown
:::table[Forward differences at x = 1]{#tab-forward}
| Step $h$ | Estimate $D_h f(1)$ | Error |
| -------: | -----------------: | ----: |
| $1/2$ | 2.500 | 0.500 |
| $1/4$ | 2.250 | 0.250 |
| $1/8$ | 2.125 | 0.125 |
These values use exact arithmetic; the decimal expansions terminate.
:::
Table 1 · Forward differences at x = 1
Step Estimate Error
2.5000.500
2.2500.250
2.1250.125

These values use exact arithmetic; the decimal expansions terminate.

Table 1 illustrates Corollary 5. Keep units, precision, and missing values explicit in a real dataset. The booktabs presentation uses horizontal rules and numeric alignment rather than a full grid.

Define a document-local macro

Keep a definition in a math expression before its first use. The definition itself produces no visible symbol.

markdown
$\newcommand{\sampleD}{D_h}$
Our local operator is $\sampleD f(x)$.

Our local operator is . Its definition belongs to this article and does not affect another article. Source completion can offer document-defined macros as well as built-in commands.

Lay out matrices and piecewise functions

These common structures work with core notation. Use & to separate columns and \\ to separate rows.

tex
\begin{bmatrix} 1 & h \\ 0 & 1 \end{bmatrix}
\begin{bmatrix} x \\ v \end{bmatrix}
= \begin{bmatrix} x+hv \\ v \end{bmatrix}
tex
g(x)=\begin{cases}
0, & x<0, \\
x^2, & x\ge 0.
\end{cases}

Add the STEM notation you need

Physics adds convenient derivatives and vector notation:

tex
\dv{x}{t}=v,\qquad
\dv[2]{x}{t}=a,\qquad
\pdv{u}{x},\qquad
\vb{F}=m\vb{a}.

Units, chemical formulas, and cancellation use their own enabled packages:

tex
v=\units[3]{m/s},\qquad
\ce{H2O},\qquad
\frac{\cancel{x}y}{\cancel{x}}=y\quad(x\ne0).

These are notation examples rather than a single physical model. Prefer separate display equations if a combined line becomes too wide. On a phone, a wide equation scrolls within its own region.

Cite a real, traceable source

Bibliography entries are written explicitly. :cite[key] creates a numbered citation; :ref[label] points to a component in this document. They serve different purposes.

markdown
The derivative is introduced in :cite[openstax-derivative].
::::references[References]
:::reference[OpenStax — Defining the Derivative]{#openstax-derivative}
OpenStax. *Calculus Volume 1*, Section 3.1.
[Read the chapter](https://openstax.org/books/calculus-volume-1/pages/3-1-defining-the-derivative).
:::
::::

References

[1] OpenStax — Defining the Derivative

OpenStax. Calculus Volume 1, Section 3.1, “Defining the Derivative.” Read the chapter. The finite-step calculations in this sample are worked out in the article itself.

Before adapting this note, check each assumption, retain stable labels, enable the required packages, and review the rendered equations as well as the source.

Footnotes

  1. In floating-point arithmetic, subtracting nearby values and dividing by a very small step can amplify rounding effects. A numerical method needs an appropriate step-size strategy as well as a truncation-error argument. ↩