integral

The region under a function, shaded, with its signed area; in space, the solid under a surface, with its volume.

integralNode
Only withxyxyzplane
On this page
A bell curve with the area beneath it shaded between x = −1 and x = 1.A bell curve with the area beneath it shaded between x = −1 and x = 1.

#Area under a curve

integral(of: #bell; from: -1; to: 1) shades the area under a curve in the same graph between two limits, and publishes it as area. of: may be an expression instead, of: x^2, and nothing else need be drawn. The limits may be expressions of parameters, so a slider sweeps the region while the reader watches area change. Both are required; without to:, 'integral' on the xy plane is the area between two limits — it needs 'to:'.

The area is taken over the limits met with the curve's own domain, never the visible window, so panning does not change it. base: is what the region closes down to: the axis, another curve (base: #supply), or an expression (base: 6), and area is then the area between. A region a path in t encloses is that curve's fill-style.

Warning
The area is signed: where the function dips below its base, the region follows it down and counts against area.

#Riemann sums

n: draws the Riemann sum instead: n rectangles across the limits, each as tall as the function at the middle of its cell, or at its lower or upper end with sample:. area is then the sum, and exact is the integral it approximates, so the two can be set side by side. A slider on n re-divides it.

graph{
    integral#sum(of: x^2; from: 0; to: 2; n: k; label: {{round(#sum.area, 3)}} of {{round(#sum.exact, 3)}})
    slider:k(range: [1, 32]; default: 4; step: 1; name: rectangles)
}

#Volume in space

In space an integral is the volume under a surface, of: #hill or an expression in x and y, drawn as the solid. The region is written as the bounds of its iterated integral, the inner bound free to read the outer variable: x: [0, 2]; y: [0, 1 - x], or polar, theta: [0, 2pi]; r: [0, 2 cos(theta)]. from and to are refused there, and n: draws an n by n grid of boxes. It publishes volume where the plane publishes area, the sum where there are boxes, and exact is the volume. The argand and polar planes take no integral.


#Attributes

ofRequiredImplicitAnimatable
The function: #id for a curve on the line or a surface in space in this environment, or an expression written out, y = f(x) on the line and z = f(x, y) in space.
surface-of
Also written: curve, underCan be written as shorthand: integral:value
fromAnimatable
On the line, where the region starts. May be an expression in the parameters. Required there, refused in space.
Also written: a, start
toAnimatable
On the line, where it ends. May be an expression in the parameters. Required there, refused in space.
Also written: b, end
xAnimatable
In space, the bounds of x, e.g. [0, 2], or [0, y] when x is the inner variable.
region-bound
yAnimatable
In space, the bounds of y, e.g. [0, 1 - x] — the inner bound may read the outer variable.
region-bound
thetaAnimatable
In space, the polar form's outer bound: the angles the region turns through, e.g. [0, 2pi].
region-bound
rAnimatable
In space, the polar form's inner bound: the radii at each angle, e.g. [0, 2 cos(theta)].
region-bound
baseAnimatable
What the region closes down to: the axis, or the floor z = 0 in space, unless this names something else — another curve or surface by #id, or an expression (base: 6). The published numbers are then the area or volume between.
surface-of
Also written: down-to, floor, above
nAnimatable
Draw the Riemann sum instead of the region: n rectangles across the limits on the line, or n boxes along each side of the region in space. Parametised, so a slider re-divides it.
sampleAnimatable
Where each rectangle or box reads its height: the middle of its cell, or its end nearest the start of each bound (lower) or farthest from it (upper).
midpointlowerupper
Defaultmidpoint
colourAnimatable
The fill and its edges. Blue when not given.
paint
Also written: color
Defaultblue
opacityAnimatable
How heavy the fill is, 0 to 1. A shaded area and a solid are translucent by default; rectangles and boxes nearly opaque.
styleAnimatable
How the shaded region, or each Riemann rectangle, is filled: solid, hatched, dotted or outlined. One value for the whole integral.
solidhatcheddottedoutlined
Defaultsolid
edges
On the line, draw a line down to the base at each limit.
Defaulttrue
label
Text drawn in the middle of the region — rich text, so $maths$ renders.
hiddenAnimatable
Declared and framed, but not drawn.
Defaultfalse
lock
A reader may not edit it on an editable graph.
Also written: locked
Defaultfalse
layerAnimatable
Paint order among the marks: a higher layer is drawn later, on top; equal or omitted, the marks stack in document order, later on top.
group
The groups this mark belongs to, comma-separated: group: Early sown, Projected. It is drawn in the colour of the first that has one and the style of the first the graph's key: gives one, unless it writes its own colour: or style, and the footer's key names every group.

#Derived attributes

Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.

On any plane
exactDerived
The integral itself, whatever n is — the area on the plane, the volume in space — which is what a Riemann sum is set beside: {{#sum.area}} against {{#sum.exact}}.
Only withxyplane
areaDerived
On the plane, the number the picture is, in square units of the axes: the area between the curve and its base where the region is drawn, the Riemann sum where n: draws rectangles; signed, so a stretch below the base counts against it. A dash where a limit or the function does not resolve.
Only withxyzplane
volumeDerived
In space, the number the picture is, in cubic units of the box: the volume between the surface and its base over the region, or the sum of the Riemann boxes where n: draws them. A dash where the surface or a bound does not resolve.

#Allowed in

#Examples

A bell curve with the area beneath it from −1 to 1 shaded and labelled 0.68.A bell curve with the area beneath it from −1 to 1 shaded and labelled 0.68.
graph{
    curve#bell(expression: exp(-x^2 / 2))
    integral(of: #bell; from: -1; to: 1; label: $0.68$)
}(
    x-domain: [-3, 3]
)
The teal area under y = x² from 0 to 2, with no curve drawn over it.The teal area under y = x² from 0 to 2, with no curve drawn over it.
graph{
    integral(of: x^2; from: 0; to: 2; colour: teal)
}(
    x-domain: [-1, 3]
    y-domain: [0, 5]
)
A rising velocity curve with the faint area beneath it from 0 to 5 shaded, its edges left undrawn.A rising velocity curve with the faint area beneath it from 0 to 5 shaded, its edges left undrawn.
graph{
    curve#velocity(expression: 2 + x - x^2 / 10)
    integral(of: #velocity; from: 0; to: 5; opacity: 0.2; !edges)
}(
    x-domain: [0, 6]
    y-domain: [0, 6]
)
Eight rectangles under y = x² from 0 to 2, each as tall as the curve at its midpoint: the Riemann sum the integral is the limit of.Eight rectangles under y = x² from 0 to 2, each as tall as the curve at its midpoint: the Riemann sum the integral is the limit of.
graph{
    curve#parabola(expression: x^2)
    integral(of: #parabola; from: 0; to: 2; n: 8)
}(
    x-domain: [0, 2]
    y-domain: [0, 4]
)
In space, the volume under the plane z = 4 − x − y over the triangle 0 ≤ x ≤ 2, 0 ≤ y ≤ 2 − x, drawn as the solid itself.In space, the volume under the plane z = 4 − x − y over the triangle 0 ≤ x ≤ 2, 0 ≤ y ≤ 2 − x, drawn as the solid itself.
graph:xyz{
    integral(of: 4 - x - y; x: [0, 2]; y: [0, 2 - x])
}(
    x domain: [0, 2]
    y domain: [0, 2]
    z domain: [0, 4]
)
The volume under the bell z = 3e^(−(x² + y²)/2) over the disc of radius 1.5, written in polar bounds.The volume under the bell z = 3e^(−(x² + y²)/2) over the disc of radius 1.5, written in polar bounds.
graph:xyz{
    integral(of: 3 * e^(-(x^2 + y^2) / 2); theta: [0, 2pi]; r: [0, 1.5]; colour: purple; opacity: 0.8)
}(
    x domain: [-2, 2]
    y domain: [-2, 2]
    z domain: [0, 3]
)
Sixteen boxes under z = 16 − x² − 2y² over [0, 2] × [0, 2], each as tall as the surface at its midpoint, inside the solid they approximate.Sixteen boxes under z = 16 − x² − 2y² over [0, 2] × [0, 2], each as tall as the surface at its midpoint, inside the solid they approximate.
graph:xyz{
    integral(of: 16 - x^2 - 2 * y^2; x: [0, 2]; y: [0, 2]; opacity: 0.2)
    integral(of: 16 - x^2 - 2 * y^2; x: [0, 2]; y: [0, 2]; n: 4; colour: orange)
}(
    x domain: [0, 2]
    y domain: [0, 2]
    z domain: [0, 16]
)
Eight by eight boxes under the same hill, each read at its lower corner, so every box overshoots the surface.Eight by eight boxes under the same hill, each read at its lower corner, so every box overshoots the surface.
graph:xyz{
    surface(expression: 16 - x^2 - 2 * y^2; opacity: 0.3)
    integral(of: 16 - x^2 - 2 * y^2; x: [0, 2]; y: [0, 2]; n: 8; sample: lower; colour: teal)
}(
    x domain: [0, 2]
    y domain: [0, 2]
    z domain: [0, 16]
)

#Notes

  • The region is sampled from of:, so it follows an animated expression, and a parameter in any limit or bound.

#Writing guidance

Last updated