Calculus
Calculus is the mathematical study of continuous change.
It has two main branches: differential calculus and integral calculus. These two branches are related by the fundamental theorem of calculus:
\int_a^b f(x) \,\mathrm{d}x = F(b) - F(a)
...where F
is an antiderivative of f
, that is F' = f
.
To calculate the derivative of a function, use the D
function to
calculate a symbolic derivative or ND
to calculate a numerical approximation
To calculate the integral (antiderivative) of a function, use the
Integrate
function to calculate a symbolic integral or NIntegrate
to
calculate a numerical approximation.
To calculate the limit of a function, use the Limit
function.
Derivative
The derivative of a function is a measure of how the function changes as its input changes.
It is the ratio of the change in the value of a function to the change in its input value.
The derivative of a function f(x)
with respect to its input x
is denoted by:
The derivative of a function f(x)
is defined as:
f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}
where \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}
is the limit of the ratio of the change in the value of the function to the change in its input value as h
approaches 0
.
The limit is taken as h
approaches 0
because the derivative is the instantaneous rate of change of the function at a point, and the change in the input value must be infinitesimally small to be instantaneous.
- Wikipedia: Derivative
- Wikipedia: Notation for Differentiation, Leibniz's Notation, Lagrange's Notation, Newton's Notation
- Wolfram Mathworld: Derivative
- NIST: Derivative
LaTeX | MathJSON |
---|---|
f'(x) | ["Derivative", "f", "x"] |
f\prime(x) | ["Derivative", "f", "x"] |
f^{\prime}(x) | ["Derivative", "f", "x"] |
f''(x) | ["Derivative", "f", "x", "x"] |
f\prime\prime(x) | ["Derivative", "f", "x", "x"] |
f^{\prime\prime}(x) | ["Derivative", "f", "x", "x"] |
f\doubleprime(x) | ["Derivative", "f", "x", "x"] |
f^{(n)}(x) | ["Derivative", "f", "x", n] |
The Derivative
function represents a derivative of a function with respect to a single variable.
The D
function is used to calculate the symbolic derivative of a function with respect to one or more variables.
The ND
function is used to calculate a numerical approximation of the derivative of a function.
D: (f: number -> number, var: symbol) -> (number -> number)
The D
function represents the partial derivative of a function f
with respect to
the variable var
.
["D", "f", "x"]
D: (f, ...var: symbol) -> (number -> number)
Multiple variables can be specified to compute the partial derivative of a multivariate function.
["D", "f", "x", "y"]
A variable can be repeated to compute the second derivative of a function.
["D", "f", "x", "x"]
ND: (f: number -> number, x: number) -> number
The ND
function returns a numerical approximation of the partial derivative of a function f
at the point x
.
["ND", "Sin", 1]
// ➔ 0.5403023058681398
Note: ["ND", "Sin", 1]
is equivalent to ["Apply", ["D", "Sin"], 1]
.
Derivative: (f: number -> number) -> (number -> number)
The Derivative
function represents the derivative of a function f
.
["Apply", ["Derivative", "f"], "x"]
Derivative: (f: number -> number, n: integer) -> (number -> number)
When an argument n
is present it represents the n-th derivative of a function expr.
["Apply", ["Derivative", "f", n], "x"]
Derivative
is an operator in the mathematical sense, that is, a function that takes a function
as an argument and returns a function.
The Derivative
function is used to represent the derivative of a function in a symbolic form. It is not used to calculate the derivative of a function. To calculate the derivative of a function, use the D
function or ND
to calculate a numerical approximation.
["Derivative", "f", "x"]
is equivalent to
["D", ["f", "x"], "x"]
Integral
The integral of a function f(x)
is denoted by:
The commands \!
and \,
adjust the spacing. The \!
command reduces the space between the integral sign and the integrand, while the \,
command increases the space before the differential operator d
.
The \mathrm
command is used to typeset the differential operator d
in an upright font.
These typesetting conventions are part of the ISO 80000-2:2009 standard for mathematical notation, but are not universally adopted.
The indefinite integral of a function f(x)
is the family of all antiderivatives of a function:
\int f(x) \,\mathrm{d}x = F(x) + C
where F(x)
is the antiderivative of f(x)
, meaning F'(x) = f(x)
and C
is the constant of integration, accounting for the fact that there are many functions that can have the same derivative, differing only by a constant.
A definite integral of a function f(x)
is the signed area under the curve of the function between two points a
and b
:
\int_a^b f(x) \,\mathrm{d}x = F(b) - F(a)
The \limits
command controls the placement of the limits of integration.
A double integral of a function f(x, y)
is the signed volume under the surface of the function between two points a
and b
in the x-direction and two points c
and d
in the y-direction:
The \iint
command is used to typeset the double integral symbol.
To calculate the symbolic integral of a function, use the Integrate
function.
To calculate a numerical approximation of the integral of a function, use the NIntegrate
function.
- Wikipedia: Integral, Antiderivative, Integral Symbol
- Wolfram Mathworld: Integral
- NIST: Integral
Integrate: (f: function) -> function
Evaluates to a symbolic indefinite integral of a function f
.
["Integrate", "Sin"]
The argument f
, the integrand, is a function literal, which can be expressed in different ways:
- As a symbol whose value is a function:
["Integrate", "f"]
- As a symbol for a built-in function:
["Integrate", "Sin"]
- As a
["Function"]
expression:["Integrate", ["Function", ["Sin", "x"], "x"]]
- As a shorthand function literal:
["Integrate", ["Power", "_", 2]]
- As an expression with unknowns:
["Integrate", ["Power", "x", 2]]
Integrate: (f: function, ...var:symbol)
Symbolic indefinite integral of a function f
with respect to a variable x
.
["Integrate", ["Sin", "x"], "x"]
Symbolic indefinite integral of a function f
with respect to a variable x
and y
.
["Integrate",
["Add", ["Sin", ["Power", "x", 2]], ["Power", "y", 2]],
"x", "y"
]
Symbolic indefinite integral of a function f
with respect to a variable x
, applied twice.
["Integrate", ["Sin", "x"], "x", "x"]
Integrate: (f: function, ...limits:tuple)
A definite integral of a function f
. The function is evaluated
symbolically as:
\int_a^b f(x) \,\mathrm{d}x = F(b) - F(a)
where F
is the antiderivative of f
.
The limits
tuples indicate the variable of integration and the limits of integration.
The first element of the tuple is the variable of integration, and the second and third elements are the lower and upper limits of integration, respectively.
["Integrate",
["Power", "x", 2],
["Tuple", "x", 0, 2]
]
The variable of integration can be omitted if it is the same as the argument of the function.
["Integrate",
["Power", "x", 2],
["Tuple", 0, 2]
]
Double integrals can be computed by specifying more than one limit.
["Integrate",
["Add", ["Power", "x", 2], ["Power", "y", 2]],
["Tuple", "x", 0, 2],
["Tuple", "y", 1, 3]
]
Some functions do not have a closed form for their antiderivative, and the integral cannot be computed symbolically. In this case, the Integrate
function returns a symbolic representation of the integral. Use NIntegrate
to compute a numerical approximation of the integral.
NIntegrate: (f:function, ...limits:tuple) -> number
Calculate a numerical approximation of the definite integral of a function.
["NIntegrate", ["Power", "x", 2], ["Tuple", 0, 2]]
// -> 2.6666666666666665
The limits
tuples indicate the variable of integration and the limits of integration.
The first element of the tuple is the variable of integration, and the second and third elements are the lower and upper limits of integration, respectively.
The variable of integration can be omitted if it is the same as the argument of the function.
["NIntegrate", ["Power", "x", 2], ["Tuple", 0, 2]]
// -> 2.6666666666666665
A double integral can be computed by specifying more than one limit.
["NIntegrate",
["Add", ["Power", "x", 2], ["Power", "y", 2]],
["Tuple", 0, 2],
["Tuple", 1, 3]
]
// -> 20.666666666666668
The numerical approximation is computed using a Monte Carlo method.
Limit
The limit of a function f(x)
as x
approaches a value a
is the value that
f(x)
approaches as x
gets arbitrarily close to a
.
It is denoted by:
["Limit", ["f", "x"], "a"]
Limit: (f: function, value: number) -> number
Evaluate the function f as it approaches the value value.
["Limit", ["Divide", ["Sin", "_"], "_"], 0]
["Limit", ["Function", ["Divide", ["Sin", "x"], "x"], "x"], 0]
This function evaluates to a numerical approximation when using expr.N()
. To
get a numerical evaluation with expr.evaluate()
, use NLimit
.
NLimit: (f: function, value: number)
Evaluate the function f as it approaches the value value.
["NLimit", ["Divide", ["Sin", "_"], "_"], 0]
// ➔ 1
["NLimit", ["Function", ["Divide", ["Sin", "x"], "x"], "x"], 0]
// ➔ 1
The numerical approximation is computed using a Richardson extrapolation algorithm.