Riemann Sum Explorer

The learner moves the number of subintervals n (or drags partition points and sample points) and watches left, right, midpoint, trapezoid, upper, lower, tagged or random sums of f on [a, b] close in on the integral, with rectangles below the axis counted negatively. Options add the U − L gap, a closed form of the sum, a sums-against-n panel, comparison functions including the Dirichlet function, rectangles between two curves, mean value points (FTC 2), and a series mode where unit-width rectangles of a_n = f(n) are trapped between integrals (integral test, remainder estimate, H_N − ln N).

Used in: Mathematical Analysis, Single Variable Calculus

Props

PropTypeDefaultDescription
titlestring"Riemann sums" ("Sums and integrals of a series" in series mode)Card title.
modestring"riemann"riemann: sums over a partition of [a, b]. series: rectangles of width 1 and height a_n = f(n) for n = startIndex..N against the curve y = f(x) (integral test, remainder estimate, H_N − ln N).
fstring"x^2" ("1/x" in series mode)The integrand (series mode: the term function, a_n = f(n)) as an expression in x and the parameter names. A leading "y =", "rho =" or "f(x) =" is ignored. Supports + - * / ^, implicit multiplication, |u|, comparisons (1 or 0), if(cond, a, b), pi, e, and sin cos tan sec csc cot arcsin arccos arctan sinh cosh tanh sqrt cbrt exp ln log abs sign floor ceil round min max factorial. A jump: "if(x < 2, 1, 3)". Names that are not parameters become sliders (-5 to 5, starting at 1). "dirichlet" is the Dirichlet function.
fTexstringprinted from fTeX for f in the formula line when the automatic printing is not what the page uses.
fLabelstring"$y = f(x)$"Legend label of the curve ($...$ TeX).
parameters{name, min, max, initial?, step?, label?}[]sliders for the free names of the expressionsNamed parameters, each with a slider; usable in f, between, antiderivative, compare, interval, exact and the formulas. x, n, N and k are reserved.
interval[number | string, number | string][0, 2] (the ends of partition when only that is given)Riemann mode: the interval [a, b]. Entries may be expressions in the parameters.
ninteger4 (10 in series mode)Starting number of subintervals (series mode: the index N of the last term).
nRange[integer, integer][1, 50] ([startIndex, 50] in series mode)Range of the n slider (capped at 1000 subintervals; 5000 terms in series mode).
rulesstring[]["left", "right", "mid"]Riemann mode: the sums offered, the first drawn first: left, right, mid (midpoint), trap (trapezoids), upper (max of f on each subinterval), lower (min), tagged (sample points the learner drags), random (seeded random sample points, with a New button), mvt (mean value points where f equals its average, so the sum equals F(b) − F(a); needs antiderivative). A table lists every offered sum at the current n.
tagsnumber[]midpointsStarting sample points of the tagged rule, one per subinterval of the starting partition (x values).
seednumber1Seed of the random sample points.
partitionnumber[]none (a regular partition with the n slider)An editable partition: its interior points are dragged along the axis and a Refine button adds every midpoint; with upper or lower in rules, the U and ℓ values before each refinement are listed (they only tighten).
exactnumber | stringnoneVerified value of the integral (the exact area): its row, the error of each sum, and its line on the convergence panel. May use parameters.
showGapbooleanfalseShades the gap between the bracketing sums with its value: U − ℓ when rules include upper or lower, else R − L (for monotone f, |f(b) − f(a)|·Δx).
gapFormulastringnoneWith showGap: the closed form of the gap in n (e.g. "1/n"), with its value at the current n.
sumFormulastringnoneClosed form in n of the first rule's sum (e.g. "8/3 + 4/n + 4/(3*n^2)"; a leading "R_n =" is ignored), with its value at the current n and its curve on the convergence panel.
showConvergencebooleanfalseAdds a panel of each offered sum against n over nRange, with the exact value and the closed form.
antiderivativestringnoneAn antiderivative F(x): enables the mvt rule and the row F(b) − F(a).
betweenstringnoneA lower curve g(x): rectangles stand between g and f with heights h = f − g (area between curves).
comparestring[]noneOther functions on the same interval and partition, chosen from a Function dropdown (e.g. "y = sqrt(x)", or "dirichlet" for the Dirichlet function, whose upper and lower sums never meet). exact and the formulas belong to f only.
discontinuitiesnumber[]nonePoints where f jumps, sampled on both sides when finding the max and min on each subinterval.
signedPartsbooleanfalseAsks for the sentence splitting the sum into rectangles above the axis (added) and below it (subtracted).
startIndexinteger1Series mode: the first index n0.
alignstring"left"Series mode: left puts the rectangle of a_n over [n, n + 1] (above a decreasing curve), right over [n − 1, n] (below it; the first term stands outside the integral), toggle offers a switch.
sliversbooleanfalseSeries mode: shades the slivers of the rectangles above the curve and reads out D_N = S_N − ∫ from n0 to N of f (e.g. H_N − ln N).
stackSliversbooleanfalseWith slivers: a switch slides every sliver left into one column of width 1, where they fit in height a_n0 − a_N.
differenceLimitnumbernoneWith slivers: the verified limit L of D_N (e.g. Euler's constant 0.5772156649), with the error D_N − L and its bound a_N.
sumnumbernoneSeries mode: the verified sum S of the series, with the remainder S − S_N.
showRemainderbooleanfalseSeries mode: shades the area beyond x = N and reads out the bracket ∫ from N+1 to ∞ ≤ R_N ≤ ∫ from N to ∞, and the interval for S it gives.
tailIntegralstringcomputed numericallyClosed form of the integral of f from N to infinity, in N (e.g. "1/N"), used by the remainder bracket.
notestringnoneOne short sentence under the formula line ($...$ TeX allowed).
xRange[number, number][a, b] padded (series mode: follows N)Visible x range.
yRange[number, number]from f over the view, including 0Visible y range.
xLabelstring"$x$"x-axis title ($...$ TeX), e.g. "stretch (m)".
yLabelstring"$y = f(x)$"y-axis title ($...$ TeX), e.g. "force (N)".
presets{label, ...props}[]noneOther examples in an Example dropdown; each overrides the props it names. A preset that sets its own f drops the integrand's exact, formulas, antiderivative, between, compare, sum and limits unless it sets them.
presetLabelstring"Main example"Dropdown name of the configuration given by the props themselves.
controlsstring[]all controls shownIds of the hideable controls to show (see the controls registry); core ones always show. Absent = everything. Fitted per page by tooling, not by hand.