Approximation & signals

Numerical Differentiation Noise Lab

Numerical differentiation with modelled readings: forward, backward, central and five-point difference formulas for five functions on a 25-step scale from 1 to 1E-8, readings that carry 3 to 8 significant digits (a seeded rounding model) and optional noise, the observed error, the exact-readings error and an error bound with the best step of each method, then 101 noisy samples with stride differences, least-squares windows and their RMS slope errors, and five challenges scored by the lab.

Last updated

Calculator overview

Inputs and outputs

This summary comes from the calculator's published input and output contract.

Inputs

Method (required)
About this input

The difference formula shown at the marked step: Forward, Backward, Central or Five-point. Tap a method chip.

Default Central Allowed Forward, Backward, Central, Five-point
Sample span L (required)
About this input

The width of the sampled interval centred on the point, from 0.5 to 6.3. The 101 samples are spread evenly across it.

Default 2 Range 0.5 to 6.3
Random seed (required)
About this input

The seed of the rounding and noise draws, a whole number from 1 to 2147483646; the same seed gives the same readings. Every challenge fixes it.

Default 2026 Range 1 to 2147483646
Window half-width w (required)
About this input

w, the half-width of the least-squares window: the slope at a sample is the slope of the best straight line through 2w + 1 samples; from 1 to 10.

Default 3 Range 1 to 10
Stride m (required)
About this input

m, the stride of the sample central difference: the slope at a sample uses the samples m places to each side; from 1 to 10.

Default 1 Range 1 to 10
Marked step (position on the step scale) (required)
About this input

The marked step as a position on the step scale: 0 is the step 1, 6 is 0.01, 24 is 1E-8. Drag the step marker on the error chart.

Default 6 Range 0 to 24
Digits each reading carries (required)
About this input

How many significant digits each reading carries, a whole number from 3 to 8. Fewer digits mean larger rounding in every reading.

Default 6 Range 3 to 8
Challenge number (required)
About this input

0 for free play; 1 to 5 load a challenge, whose settings replace yours except the ones it leaves to you.

Default 0 Range 0 to 5
Your prediction: the method with the smaller best bound (required)
About this input

Challenge 4 only: your prediction of the method with the smaller best error bound, Central or Five-point. It starts on Not yet chosen.

Default Not yet chosen Allowed Not yet chosen, Central, Five-point
Your prediction: the best step position
When omitted Blank
About this input

Challenge 1 only: your prediction of the step position where the central difference is most accurate. Blank until you place it.

Default Not set Range 0 to 24
Noise level (standard deviation) (required)
About this input

The standard deviation of the random noise added to every reading, from 0 to 0.1.

Default 0 Range 0 to 0.1
Function (required)
About this input

The function whose slope is estimated: Sine, Exponential, Natural log, Cubic (x^3 - 2x) or Square root. Chosen with the function chips above the plot.

Default Sine Allowed Sine, Exponential, Natural log, Cubic, Square root
Point x0 (required)
About this input

The point x0 where the slope is wanted, from 0.5 to 3. Drag the point line on the function plot; the popover takes an exact value.

Default 1 Range 0.5 to 3

Outputs

Sample spacing
About this output

The distance between neighbouring samples, the span divided by 100.

No unit declared
The noisy samples and their slopes
About this output

The 101 samples: x, the noisy reading, the exact value, the noise band, the exact slope and the stride and window slopes (blank near the ends).

No unit declared
Unit roundoff of the readings
About this output

The unit roundoff u = 0.5 x 10^(1 - d) of readings with d significant digits.

No unit declared
Estimated slope at the marked step
About this output

The slope estimated by the chosen method at the marked step from the modelled readings.

No unit declared
Error of the estimate (signed)
About this output

The estimate minus the exact slope (signed).

No unit declared
Sample span used
About this output

The sample span used.

No unit declared
Best observed step, forward
About this output

The step on the scale where the forward difference's observed error is smallest (ties go to the larger step).

No unit declared
Best observed step, five-point
About this output

The step where the five-point formula's observed error is smallest.

No unit declared
Best observed step, central
About this output

The step where the central difference's observed error is smallest.

No unit declared
Rounding part of the bound
About this output

The rounding part of the bound at the marked step: the worst effect of the readings' rounding on the estimate.

No unit declared
Seed used
About this output

The seed used (every challenge fixes 2029).

No unit declared
Digits used
About this output

The digits each reading carries, as used.

No unit declared
Method used
About this output

The method used at the marked step.

No unit declared
Typical slope error, stride (RMS)
About this output

The typical (root mean square) slope error of the stride-m central differences over samples 11 to 91.

No unit declared
Stride used
About this output

The stride used.

No unit declared
The step sweep: error sizes, bounds and exact-readings errors at each step
About this output

For every step on the scale: the step, the error sizes and the error bounds of the four methods, and the forward and central errors with exact readings. Blank where a step is skipped, below 1E-16, or withheld in a challenge.

No unit declared
Typical slope error, window (RMS)
About this output

The typical (root mean square) slope error of the least-squares windows of half-width w over samples 11 to 91.

No unit declared
Window half-width used
About this output

The window half-width used.

No unit declared
Formula error with exact readings
About this output

The size of the chosen method's error with exact readings at the marked step (the formula's own error); shown for steps of 0.001 and more.

No unit declared
The true slope line and the estimated slope line
About this output

The true slope line and the estimated slope line at three x values (x0 - 1, x0, x0 + 1).

No unit declared
Steps skipped (past the domain)
About this output

How many steps were skipped because their widest reading point falls below 0.1 (Natural log and Square root only).

No unit declared
Marked step h
About this output

The step h at the marked position.

No unit declared
Step position used
About this output

The marked step position used.

No unit declared
The readings used at the marked step
About this output

The five reading points of the marked step: their offset, x, the modelled reading and the exact value.

No unit declared
Typical slope error by stride and by window half-width
About this output

For strides and half-widths 1 to 10: the typical slope error of the stride differences and of the least-squares windows.

No unit declared
Smallest observed error, forward
About this output

The smallest observed error size of the forward difference over the scale.

No unit declared
Challenge feedback
About this output

What the result means, or the prompt to make a prediction first.

No unit declared
Best step by the bound, forward
About this output

The step where the forward difference's error bound is smallest; it does not depend on the seed.

No unit declared
Best step by the bound, five-point
About this output

The step where the five-point formula's error bound is smallest.

No unit declared
Challenge score
About this output

100 when the selected challenge is met, otherwise 0.

No unit declared
Challenge: the value scored
About this output

The value the challenge scores: the prediction minus the best position (1), the error bound (2, 5), the stride RMS error (3), or the ratio of the central to the five-point best bound (4).

No unit declared
Challenge goal
About this output

What the selected challenge asks for.

No unit declared
Smallest bound, central
About this output

The smallest error bound of the central difference over the scale.

No unit declared
Window half-width with the smallest RMS error
About this output

The window half-width from 1 to 10 with the smallest typical slope error (ties go to the larger window).

No unit declared
Stride with the smallest RMS error
About this output

The stride from 1 to 10 with the smallest typical slope error (ties go to the larger stride).

No unit declared
Best step by the bound, central
About this output

The step where the central difference's error bound is smallest.

No unit declared
Smallest bound, forward
About this output

The smallest error bound of the forward difference over the scale.

No unit declared
Smallest bound, five-point
About this output

The smallest error bound of the five-point formula over the scale.

No unit declared
Challenge result
About this output

No challenge selected, MET or NOT MET.

No unit declared
Noise part of the bound
About this output

The noise part of the bound at the marked step: one standard deviation of the estimate due to the noise.

No unit declared
Formula module versions
About this output

The versions of the formula modules this lab uses.

No unit declared
Model version
About this output

The version of this lab's model.

No unit declared
Smallest observed error, five-point
About this output

The smallest observed error size of the five-point formula over the scale.

No unit declared
Smallest observed error, central
About this output

The smallest observed error size of the central difference over the scale.

No unit declared
Noise level used
About this output

The noise level used.

No unit declared
Exact slope at the point
About this output

The exact slope of the function at the point, from its known formula.

No unit declared
Point used
About this output

The point used.

No unit declared
Error bound at the marked step
About this output

The error bound of the chosen method at the marked step: the error with exact readings, plus the worst rounding of the readings, plus one noise standard deviation.

No unit declared
Model Status
About this output

OK, or CHECK: (a skipped step or a skipped samples part) or NOT VALID: (an input out of range) with the reason.

No unit declared
Function used
About this output

The function used (a challenge may fix it).

No unit declared
The function around the point
About this output

The function at 81 points around x0 (spacing 0.05), for the plot.

No unit declared
This page is provided by LogicCommons for informational purposes only. Results are analysis outputs computed from the inputs you supply and are not professional advice. Verify all inputs and results independently.

LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.

Methodology

Purpose and model boundary

This lab estimates the slope of a known function at a point from readings of that function. The function is one of five fixed ones (sine, exponential, natural log, a cubic and square root), and the point x0 is from 0.5 to 3. Each reading carries a chosen number of significant digits, from 3 to 8, with modelled rounding and optional random noise. In its first part the model applies four difference formulas (forward, backward, central and five-point) on a fixed scale of 25 steps from 1 down to 1×10⁻⁸, and returns, for every step, each method's error and an error bound, the best step of each method by both measures, and the estimate, error and bound at the step you mark. In its second part it reads 101 noisy samples around the point and compares slopes from differences over a stride with slopes from least-squares straight-line windows, with the typical error of each. Five scored challenges go with it.

It is a lab for learning how a slope estimate from readings goes wrong: why a smaller step is not always better, why the error of each formula first falls and then rises as the step shrinks, how more digits move the best step and how noise changes the picture, and why averaging over wider strides or windows helps with noisy samples until the curve's bending adds an error of its own. It is not a tool for differentiating real data. Its readings and noise are modelled, not measured; the rounding is the modelled rounding of the readings, not the computer's own, and the steps stop at 1×10⁻⁸.

The model is the calculation authority. The page sends the values you set to the model and draws only what it returns: the function curve, the true and estimated slope lines, the readings used, the error and bound curves, the noisy samples and their noise band, the three slope curves and the bars of typical slope error. The page computes no reading, estimate, error, bound or best step itself.

Inputs and units

Every input is a pure number or a choice; the functions are dimensionless and the lab has no units.

Input Meaning and unit
Function Sine (default), Exponential, Natural log, Cubic or Square root: f(x) = sin x, eˣ, ln x, x³ - 2x or √x.
Point x0 From 0.5 to 3 (default 1): the point where the slope is wanted.
Marked step A whole-number position from 0 to 24 on the step scale (default 6): 0 is the step 1, 6 is 0.01 and 24 is 1×10⁻⁸.
Method Forward, Backward, Central (default) or Five-point: the formula used for the estimate at the marked step.
Digits each reading carries A whole number from 3 to 8 (default 6). Fewer digits mean larger rounding in every reading.
Noise level From 0 to 0.1 (default 0): the standard deviation σ of the random noise added to every reading.
Random seed A whole number from 1 to 2147483646 (default 2026): the same seed gives the same readings. Every challenge fixes it at 2029.
Sample span L From 0.5 to 6.3 (default 2): the width of the sampled interval, centred on x0. The 101 samples are spread evenly across it.
Stride m A whole number from 1 to 10 (default 1): the slope at a sample uses the samples m places to each side.
Window half-width w A whole number from 1 to 10 (default 3): the slope at a sample is the slope of the best straight line through 2w + 1 samples.
Challenge number 0 for free exploration, or 1 to 5 to load a challenge.
Your prediction: the best step position Blank until you place it, or a whole-number position from 0 to 24: your answer for challenge 1.
Your prediction: the method with the smaller best bound Not yet chosen (the start), Central or Five-point: your answer for challenge 4.

Where each input is set:

  • On the canvas only: the function (chips above the function plot), the point (a line dragged along the x axis of the function plot, with an exact entry), the marked step (a marker dragged along the step axis of the error chart: Right Arrow takes a larger step, Left Arrow a smaller one, and the exact entry takes a step h), the method (chips beside the error chart; at the Explore level only Forward and Central are offered), the reading digits (a stepper), the noise level (a ruler handle beside the noise band), the sample span (either end of the sampled interval, both ends moving together), the stride and the window half-width (steppers on the samples), and your two predictions, which appear only in their own challenges: a dashed line placed on the step axis in challenge 1, and the choice of Central or Five-point in challenge 4. None of these is in the input panel.
  • In the input panel: the random seed, from the Experiment level on, and the challenge picker.

A learning level changes only what is shown, never a calculation. Explore shows the function, the point, the marked step, the method and the digits; Experiment adds the noise, the seed, the span, the stride and the window.

Governing relationships

The functions and their exact slopes. The model evaluates f and its exact slope f′ from their known formulas: sin x and cos x; eˣ and eˣ; ln x and 1/x; x³ - 2x and 3·x² - 2; √x and 1/(2·√x). The exact slope at x0 is the value every estimate is measured against.

The step scale. The 25 steps h, at positions 0 to 24, are 1, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01 and so on down the same pattern to 2×10⁻⁸ and 1×10⁻⁸. Each step reads the function at five points x0 + j·h, j = -2, -1, 0, 1, 2.

The modelled readings. A reading keeps d significant digits. With the rounding unit u = 0.5·10^(1-d) (5×10⁻³ at 3 digits down to 5×10⁻⁸ at 8), a reading of the exact value f(x) is

r = f(x)·(1 + δ) + σ·Z,

where δ is drawn evenly from -u to u and Z is a standard normal draw. This is the standard model of rounding: the stored value is the true one times (1 + δ) with δ no larger than the rounding unit.

The random draws. The draws come from the minimal standard generator, s_n = 48271·s_(n-1) mod (2³¹ - 1), started from the seed, with its first two outputs discarded. Each output divided by 2³¹ - 1 is a uniform draw U, never 0 or

  1. The Box-Muller transform turns each pair of uniform draws into two normal draws: √(-2·ln U₁)·cos(2π·U₂) and √(-2·ln U₁)·sin(2π·U₂). The step sweep and the samples use separate draws from the same stream, so changing the samples part never changes the step sweep.

The four difference formulas. With r₋₂ to r₂ the five readings of one step:

  • forward: (r₁ - r₀)/h;
  • backward: (r₀ - r₋₁)/h;
  • central: (r₁ - r₋₁)/(2·h);
  • five-point: (r₋₂ - 8·r₋₁ + 8·r₁ - r₂)/(12·h).

The error of an estimate is the estimate minus the exact slope. The error with exact readings applies the same formula to the exact values, with no rounding and no noise: it is the formula's own (truncation) error. Coming down from h = 1 it falls in proportion to h for the forward and backward differences, to h² for the central difference and to h⁴ for the five-point formula.

The error bound. For each method and step the bound adds three parts:

  • the size of the error with exact readings;
  • the worst rounding, with every δ at ±u against the formula's weights: u·(|f₀| + |f₁|)/h for forward, u·(|f₋₁| + |f₀|)/h for backward, u·(|f₋₁| + |f₁|)/(2·h) for central and u·(|f₋₂| + 8·|f₋₁| + 8·|f₁| + |f₂|)/(12·h) for five-point, with f_j the exact values;
  • one standard deviation of the noise in the estimate: σ·√2/h for forward and backward, σ·√0.5/h for central and σ·√130/(12·h) for five-point.

The rounding part grows as 1/h while the formula's own error shrinks, so the bound has a lowest point inside the scale. With no noise the observed error never exceeds the bound. With noise the bound adds one standard deviation, so it is a typical size, not a guarantee.

The domain rule. Natural log and square root need positive arguments, and grow steep near 0. A step is computed only while its widest point stays at or above 0.1: x0 - 2·h ≥ 0.1, with a band of 1×10⁻⁹. For the other functions every step is computed. The steps left out are counted as skipped.

The best steps. For the forward, central and five-point methods, over the computed steps, the model picks the step with the smallest observed error size and, separately, the step with the smallest bound. Values within one part in a million (relative) of the minimum count as tied, and a tie goes to the larger step. The best step of the bound does not depend on the seed. The best step of the observed error does: truncation and a random rounding error can cancel by chance at one step, so the observed minimum sits lower and can wander by a few positions.

The samples part. The sample spacing is Δ = L/100, and sample i, from 1 to 101, lies at x0 + (i - 51)·Δ. Each sample is a reading of the function with its own rounding and noise draws. At sample i:

  • the stride slope is (y_(i+m) - y_(i-m))/(2·m·Δ), a central difference over m samples to each side;
  • the window slope is Σ j·y_(i+j) / (Δ·Σ j²) for j from -w to w, where Σ j² = w·(w + 1)·(2·w + 1)/3. These are the Savitzky-Golay first-derivative weights of a least-squares straight line through the 2w + 1 samples.

Both are blank near the ends, where the stride or window would reach past sample 1 or 101. The typical slope error of a stride or a window is the root mean square of its slope minus the exact slope, over samples 11 to 91 (81 samples, where every stride and window from 1 to 10 is defined). The best stride and the best window use the same tie rule, ties going to the larger. For natural log and square root the samples part runs only while x0 - L/2 ≥ 0.1, with the same 1×10⁻⁹ band.

The noise band. For each sample the band runs from the exact value minus σ to the exact value plus σ.

Calculation sequence

  1. The model checks your inputs in the order of the status list under Errors and warnings, on the values entered.
  2. In a challenge, every input takes the challenge's value except the ones that challenge leaves to you; your predictions are never replaced.
  3. It derives the exact slope at x0, the rounding unit of the digits in use and the stream of random draws from the seed.
  4. For each of the 25 steps it applies the domain rule, then forms the five readings, the four estimates, their errors, their errors with exact readings and their bounds.
  5. It picks the best observed and best bound step of the forward, central and five-point methods, and reads the estimate, error, bound and the bound's three parts at the marked step.
  6. It runs the samples part, if the domain rule allows: the 101 samples, the stride and window slopes, their typical errors for every stride and half-width from 1 to 10, and the best stride and window.
  7. It samples the function curve, the two slope lines and the five readings of the marked step for the plot.
  8. It sets the status and, in a challenge, scores the challenge and holds back what the challenge keeps hidden.

Outputs and interpretation

  • Exact slope at the point, from the function's known formula.
  • Step at the marked position, and the estimated slope there by the chosen method, with its error (signed: the estimate minus the exact slope) and its error bound.
  • The bound's three parts at the marked step: the error with exact readings (the formula's own error, given for steps of 0.001 and more; below that the error with exact readings is mostly the computer's own rounding, far below the modelled rounding), the rounding part and the noise part.
  • Best observed step and smallest observed error of the forward, central and five-point methods, and the best bound step and smallest bound of each.
  • Steps skipped: how many large steps reach below 0.1 (natural log and square root only).
  • Typical slope error of the stride differences at your stride and of the least-squares windows at your half-width, the best stride and best window from 1 to 10, and the sample spacing Δ.
  • Rounding unit u of the digits in use.
  • Settings used: the function, point, marked step, method, digits, noise level, seed, span, stride and half-width in effect (a challenge may fix them).
  • Error table: for every step, the step, the error size and the bound of each of the four methods, and the forward and central error sizes with exact readings (steps of 0.001 and more). A skipped step is blank, and an error size below 1×10⁻¹⁶ is left blank so that no zero is drawn on a log axis.
  • Function curve: f at 81 points 0.05 apart around x0; a point below 0.1 is blank for natural log and square root.
  • Slope lines: the true slope line and the estimated slope line at x0 - 1, x0 and x0 + 1.
  • Readings of the marked step: the five points, each with its offset, x, its modelled reading and its exact value.
  • Samples: for each of the 101 samples, x, the reading, the exact value, the noise band, the exact slope and the stride and window slopes.
  • Smoothing table: the typical slope error of the stride differences and of the windows for 1 to 10.

Reading the canvas: the function plot draws the curve, the true slope line, the estimated slope line through the readings used and the five readings of the marked step. The error chart puts the step h across and the error size up, both on log axes with every decade labelled: dots are the errors of the estimates, lines are the bounds, and at the Advanced level dashed lines are the errors with exact readings. Explore draws the forward and central methods; Experiment adds the backward and five-point methods and the samples. The samples card draws the readings as dots, the exact curve and the noise band, with brackets showing the stride and the window; below it the exact slope, the stride slope and the window slope are drawn against x, and bars give the typical slope error for each stride and each half-width. In challenges 2, 3 and 5 the canvas waits for Run before it draws the curves your choice decides.

What to take from the lab: on log axes the error of each formula falls along a straight line as the step shrinks, with slope 1 for the forward and backward differences, 2 for the central difference and 4 for the five-point formula. At a small enough step it turns and climbs along slope -1, because the readings' rounding, about u·|f|/h, is divided by the step. The best step balances the two. More digits lower the bottom of the curve and move it to a smaller step; noise lifts the climbing side. In the samples, neighbouring samples amplify the noise, a wider stride divides it by a longer run, and a very wide stride or window bends away from the true slope.

Challenges

Each challenge fixes its own settings, including the seed 2029, and leaves only some inputs to you. The model scores each one MET (100) or NOT MET (0) and gives a one-line hint while it is not met.

  1. Predict the best step (introductory). For sine at 1 with 6-digit readings, place your prediction on the step scale where the central difference is most accurate. Met when your prediction is within one position of the step where the central difference's bound is smallest. The value scored is your position minus that step's position.
  2. Smaller is not always better (introductory). With 6-digit readings of sine at 1, choose the method and the step so the error bound is no larger than 0.0005. It starts on the forward difference at the smallest step. Met when the marked step is computed and its bound is at most 0.0005. The value scored is the bound.
  3. Choose the stride (intermediate). The samples carry noise of 0.01 over a span of 6.3. Choose a stride so the typical slope error is at most 0.03. Met when the samples part runs and the stride's typical error is at most 0.03. The value scored is that error.
  4. Which method wins? (intermediate). With 8-digit readings of the exponential at 1, predict which method reaches the smaller best error bound, central or five-point. Met when your choice names the method whose smallest bound is lower. The value scored is the central method's smallest bound divided by the five-point formula's.
  5. Digits budget (advanced). Using the central difference for sine at 1, choose the digits and the step so the error bound is no larger than 0.00006 with as few reading digits as possible. Met when the marked step is computed, the bound is at most 0.00006 and the readings carry the fewest digits that can reach it. The value scored is the bound.

Challenges 1, 2, 4 and 5 score the error bound, which does not depend on the seed; challenge 3 scores the noisy samples, which do.

Challenges 1 and 4 hold back the answer until you predict: while your prediction is blank or reads Not yet chosen, the error and bound columns of the error table, the error and bound at the marked step and its three parts, every best step and smallest error or bound, and the value scored are blank. The function plot, the readings, the estimate at the marked step and the step axis stay. Once you predict, every result appears, met or not. Challenges 2 and 5 withhold the best steps and the smallest errors and bounds while they are not met, because these name the answer; the curves and the bound at your own step stay. Challenge 3 withholds the window's typical error, the best stride, the best window, the whole window column of the smoothing table and every stride bar but your own while it is not met.

Validation and status logic

The status reads the first match in the list under Errors and warnings. The NOT VALID checks read the values you entered, inside a challenge too, even for inputs the challenge replaces. The two CHECK items read the values in effect after a challenge has fixed its own. A challenge number that is not a whole number from 0 to 5 counts as no challenge selected. A value outside its range is also refused by the page before the model runs.

Assumptions and limitations

  • Five fixed functions, one point from 0.5 to 3, and readings with 3 to 8 significant digits. The rounding is modelled; the computer's own rounding is not shown, and the steps stop at 1×10⁻⁸.
  • The error bound is a worst case for the rounding and one standard deviation for the noise; with noise it is a typical size, not a guarantee.
  • The best observed step depends on the seed through chance cancellation; the best bound step does not.
  • Natural log and square root skip every step whose widest point falls below 0.1, and skip the samples part when the sampled interval does.
  • Steps are taken only from the 25 on the scale, so a best step is the best of those 25, not a value between them.
  • The typical slope errors are measured over samples 11 to 91 only.
  • Best-step, best-stride and best-window picks treat values within one part in a million of the minimum as tied and take the larger. A point within about 1×10⁻⁹ of the 0.1 domain edge may fall either side of it.

Restrictions and non-computing states

Under NOT VALID every result and every table is blank, except the model's version texts, the challenge status (No challenge selected, or NOT MET when a challenge is selected), a score of 0, and the goal and not-met hint of a selected challenge.

When the marked step is skipped (CHECK, a skipped step), only the results at the marked step are blank: the estimate, its error, its bound and the bound's three parts, the five readings of the marked step and the estimated slope line. The rest of the step sweep and the samples part are unaffected.

When the samples part is skipped (CHECK, the sample interval), the samples, the smoothing table, both typical slope errors, the best stride and window and the sample spacing are blank. The step sweep is unaffected.

In the challenges, the results listed under Challenges stay blank until the challenge allows them.

Errors and warnings

The status messages, first match wins:

  • NOT VALID: choose the function from the list
  • NOT VALID: the point must be from 0.5 to 3
  • NOT VALID: the marked step must be a whole-number position from 0 to 24 on the step scale
  • NOT VALID: choose the method from the list
  • NOT VALID: the readings' digits must be a whole number from 3 to 8
  • NOT VALID: the noise level must be from 0 to 0.1
  • NOT VALID: the seed must be a whole number from 1 to 2147483646
  • NOT VALID: the sample span must be from 0.5 to 6.3
  • NOT VALID: the stride and the window half-width must be whole numbers from 1 to 10
  • NOT VALID: the challenge number must be a whole number from 0 to 5, the best-step prediction blank or a whole-number position from 0 to 24, and the method prediction chosen from the list
  • CHECK: the marked step reaches past the function's domain (its widest point falls below 0.1), so it is skipped; choose a smaller step: natural log or square root, with x0 - 2·h below 0.1 at the marked step.
  • CHECK: the sample interval reaches below 0.1, where this function is undefined or too steep, so the samples part is skipped; shorten the span or move the point right: natural log or square root, with x0 - L/2 below 0.1.
  • OK

References

This laboratory is an educational model of estimating a derivative from readings of a function. Five fixed functions (sine, exponential, natural log, cubic and square root) are read at a point and at points one and two steps h either side, for 25 steps from 1 down to 1E-8, and the forward, backward, central and five-point difference formulas give four slope estimates. Each reading keeps a chosen number of significant digits, modelled as the true value times (1 + delta) with delta drawn uniformly up to the rounding unit of those digits, plus optional random noise. The error bound adds the error each formula makes with exact readings, the worst-case rounding and one noise standard deviation, so the best step of each method is where shrinking the step stops helping. The random draws come from the MINSTD generator, multiplier 48271 modulo 2^31 - 1, seeded by the input, and the Box-Muller transform turns them into normal noise. A second part reads 101 noisy samples and compares slopes from differences over a stride with least-squares straight-line fits over a moving window.

Sources and further reading

  • Difference formulas for derivatives and their errors: R. L. Burden, J. D. Faires and A. M. Burden, Numerical Analysis, 10th edition, Cengage, 2016, chapter 4, Numerical Differentiation and Integration. Cengage
  • The model of rounding, a stored value equal to the true one times (1 + delta) with delta no larger than the unit roundoff: N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd edition, SIAM, 2002, chapter 2, Floating Point Arithmetic. doi:10.1137/1.9780898718027
  • Slopes from noisy samples by least-squares fits over a moving window: A. Savitzky and M. J. E. Golay, "Smoothing and differentiation of data by simplified least squares procedures", Analytical Chemistry 36(8), 1964, pages 1627-1639. doi:10.1021/ac60214a047
  • The minimal standard generator: S. K. Park and K. W. Miller, "Random number generators: good ones are hard to find", Communications of the ACM 31(10), 1988, pages 1192-1201. doi:10.1145/63039.63042
  • The multiplier 48271, proposed in the authors' reply in the journal's technical correspondence: S. K. Park, K. W. Miller and P. K. Stockmeyer, "Technical correspondence", Communications of the ACM 36(7), 1993. doi:10.1145/159544.376068
  • Normal random numbers from pairs of uniform ones: G. E. P. Box and M. E. Muller, "A note on the generation of random normal deviates", The Annals of Mathematical Statistics 29(2), 1958, pages 610-611. doi:10.1214/aoms/1177706645

No table or text from any of these publications is reproduced, and none of their authors or publishers has reviewed or endorses this laboratory.

This laboratory is for learning. Its results hold only within its stated ranges; its readings and noise are modelled, not measured, and it is not a tool for differentiating real data.

Results are informational and not professional advice. See our Terms of Use. Powered by SpreadsheetWeb · About · Privacy · Terms