Integrals
A load that varies along a beam. The first moment of an odd-shaped area. The work done by a force that changes with distance. Engineering is full of definite integrals, and the honest ones rarely have a tidy closed form. Maths Explore works them out numerically:
A definite integral is the area under a curve between two limits. Numerically means by sampling the curve, so the answer is always a number. Leave the limits off and you get the other kind: the antiderivative, as a formula (see Without limits: the formula).
Two ways to write it
Section titled “Two ways to write it”The integral sign and the function are the same calculation:
- The integral sign. In the maths toolbar’s Symbols group, ∫ inserts an integral with four empty boxes. The caret starts in the upper limit, and Tab moves on to the lower limit, then the expression, then the variable after the d. (Top box first is the editor’s order, not a typo.)
- The function. Type
integrate(and the hint above the field readsintegrate(expression, variable, a, b). The Built-in functions group has an integrate button too, next to root, the other numerical method.
In LaTeX the integral is \int_{0}^{2} x^2 \, dx; \mathrm{d}x reads the same as dx. The d and its variable are required. Leave them off and the block asks for them.
The variable belongs to the integral
Section titled “The variable belongs to the integral”The variable after the d is a dummy variable: it exists only inside the integral. Define above the block and the integral doesn’t notice; read further down and it still holds its own value.
Any plain name works as the variable: , , . That includes , which elsewhere on a calcsheet is the tonne. Everything else in the expression comes from the sheet in the usual way, so values and functions defined above the block can be used inside it.
The limits can carry units, as long as both are the same kind. The result’s unit is the expression’s unit times the limits’ unit:
A load per metre integrated over metres is a force; the same load times its lever arm is a moment. The units do the bookkeeping.
Two things are refused rather than guessed:
- Limits of different kinds.
0to2 mwon’t run, and nor will metres to seconds. - An expression whose units change partway, such as an
ifwith a force in one branch and a pressure in the other.
Running integrals
Section titled “Running integrals”Make the upper limit a function’s parameter and the integral becomes a running integral: the total accumulated up to any point. The limits are worked out where the integral is written, so the upper limit takes whatever value the call passes in.
The shear in a beam under a triangular load, rising from zero to over the span:
Double and triple integrals
Section titled “Double and triple integrals”Nest the integral signs. Each d pairs with an integral sign from the inside out: in , the goes with the inner to and the with the outer to .
An inner limit can depend on the outer variable, which is what makes odd shapes possible. A triangle of base and height is wide at height , so its second moment of area about its base is:
That is , as the tables say. (Nobody needs an integral for a triangle. The same block works for the shape the tables don’t have.)
The inner integral is worked out afresh at every sample of the outer one, so a double integral costs many times what a single one does, and a triple many times more. One that gets out of hand stops with integrate stopped: these nested integrals need too many evaluations rather than freezing the sheet.
Without limits: the formula
Section titled “Without limits: the formula”Leave the limits off and the answer is a formula instead of a number: the antiderivative, the function whose derivative is the expression.
Three spellings, one calculation, all in the maths toolbar’s Symbolics group:
- The integral sign without limits. ∫dx inserts it: the expression first, then Tab to the variable after the d.
- The function with two arguments,
integrate(expression, x). integrate() inserts it. - Mathcad’s arrow,
expression → integrate, x, from →integrate.
The limits decide which you get, never what the sheet happens to define: two arguments make a formula, four a number.
It is one of the symbolic operations and follows their two rules. Names defined above the block are substituted, the variable stays symbolic, and the formula becomes a number once nothing in it is unknown:
Mind the contrast with a definite integral, whose variable belongs to the integral. Here the formula is worked out first and then evaluated at the sheet’s .
No constant of integration
Section titled “No constant of integration”There is no (Mathcad leaves it off too). That keeps the formula a working function, and the difference of two calls an exact definite integral:
Right-click the definition and Show Evaluation reads . The numerical agrees.
A name holding a quantity stays a name in the formula, and brings its units with it once the formula is evaluated. The area under the shear diagram of a 4 m cantilever is the change in its bending moment:
works out as , so the answer is .
Checked before it is shown
Section titled “Checked before it is shown”The formula comes from a computer-algebra engine, and engines can be confidently wrong. So every formula is differentiated numerically and compared with the expression at a spread of points before it is shown. One that doesn’t match is refused, never displayed. (A refusal you can work around with limits; a wrong formula you might never notice.)
What it handles
Section titled “What it handles”| Expression | Formula |
|---|---|
| , base 10 | |
Some answers come back with decimal coefficients, where the exact form would need the roots of a cubic. starts The coefficients are shown to six significant figures; the formula keeps every digit, and it passed the same check as any other.
What it refuses
Section titled “What it refuses”Every refusal ends by pointing at the limits, because with limits the same integral is a number, worked out numerically:
- No formula exists in ordinary functions. gives integrate found no formula for this integral in x — for its value over a range, give the limits: integrate(f, x, a, b).
- The formula needs a special function Maths Explore can’t evaluate. is the sine integral and the imaginary error function; the message names it: integrate’s formula for this needs the sine integral Si, which Maths Explore can’t evaluate — for its value over a range, give the limits: integrate(f, x, a, b).
- The search takes more than a second. integrate gave up looking for a formula for this integral in x after 1 s and the same pointer. is one, despite having a perfectly good formula; the engine is just slow to find it.
- A function with no formula form, such as
ifor a table lookup of the variable: integrate can’t work out a formula through if(…) and the pointer. - A formula that fails the check: integrate couldn’t find a formula for this integral in x that checks out and the pointer.
How it works, and when not to trust it
Section titled “How it works, and when not to trust it”This is about the definite integral. The method is adaptive Gauss–Kronrod quadrature. It samples the expression at 15 points across each panel of the range, works the panel out two ways, and keeps halving the panels where the two answers disagree, until the whole integral agrees to about one part in . A smooth expression is done in a little over a hundred samples; a difficult one gets as many as it needs at the trouble spot.
-
It never samples the limits themselves, so an expression that is infinite at a limit but still integrable there works:
-
No answer beats a wrong one. An integral that won’t settle, such as (which is infinite), shows integrate did not converge instead of a number.
-
Jumps cost samples. An
ifthat steps partway along is handled, but the method spends several hundred samples closing in on the step. Splitting the integral at the step is quicker and exact: -
It can’t see what it never samples. A spike narrower than the gaps between samples can be missed entirely, and then the result is simply wrong, with no error. A spike a millionth wide at integrates to . If you know where a sharp feature is, split the range there.
-
Finite limits only. An limit is refused with integrate expects b to be a finite real number. (No limits at all is the formula, above.)
-
Limits the wrong way round give a negative result, as they should: .
The integral shows to the sheet’s decimal places like any other result; the figure behind it is good to about ten significant figures.
See also
Section titled “See also”- integrate: parameters, messages and examples at a glance
- Symbolic maths: the two rules the formula follows, and the other symbolic operations
- Using LaTeX: the integral sign as LaTeX
