Function reference · Calculus

integrate

Finds an antiderivative of an expression.

It handles sums, constant factors, the elementary functions, scaled arguments, and many algebraic and trigonometric forms.

If it can't find an antiderivative, it returns the integral unevaluated rather than a wrong answer. For a value between two bounds, use defint.

Notation

integrate(expression[, variable])

Write it in an expression: nerdamer('integrate(x^2+3*x+1,x)'), or in the Playground.

nerdamer.integrate

nerdamer.integrate(expression: Expression, variable?: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

import { integrate }

import { integrate } from 'nerdamer/calculus';
integrate(input: ExpressionInput, dx?: ExpressionInput, depth: number): Expression

Import only this function, from nerdamer/calculus.

Parameters

expression
Expression to integrate.
variable
Optional integration variable.

Examples

A polynomial, term by term.

integrate(x^2+3*x+1,x)
// → x+(3/2)*x^2+(1/3)*x^3
Open in Playground

A sum of functions.

integrate(sin(x)+cos(x),x)
// → -cos(x)+sin(x)
Open in Playground

A scaled argument.

integrate(sec(2*x)^2,x)
// → (1/2)*tan(2*x)
Open in Playground

No elementary antiderivative: unevaluated.

integrate(e^(x^2),x)
// → integrate(e^x^2, x)
Open in Playground

Leave out the variable when the expression has only one.

integrate(x^2)
// → (1/3)*x^3
Open in Playground

Good to know

  • Without a variable, the expression must have exactly one: integrate(5) and integrate(x*y) are errors.
  • The variable is local to the call: a value stored under its name, as in x:5, isn't substituted inside it.

← Back to Function reference