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 or ND to calculate a numerical approximation

To calculate the integral (antiderivative) of a function, use the Integrate function or NIntegrate to calculate a numerical approximation.

D

["D", expr, var]

The D function represents the partial derivative of a function expr with respect to the variable var.

f^\prime(x)
\[ f^\prime(x) \]
["D", "f", "x"]

["D", expr, var-1, var-2, …]

Multiple variables can be specified to compute the partial derivative of a multivariate function.

f^\prime(x, y)
\[ f^\prime(x, y) \]
f'(x, y)
\[ f'(x, y) \]
["D", "f", "x", "y"]

["D", expr, var, var]

A variable can be repeated to compute the second derivative of a function.

f^{\prime\prime}(x)
\[ f^{\prime\prime}(x) \]
f\doubleprime(x)
\[ f\doubleprime(x) \]
["D", "f", "x", "x"]

Explanation

The derivative is a measure of how a 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 \( f’(x) \) or \( \frac{df}{dx} \). The derivative of a function \( f(x) \) is defined as:

\[ f’(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h} \]

where:

  • \( h \) is the change in the input variable.

  • \( f(x + h) - f(x) \) is the change in the value of the function.

  • \( \frac{f(x + h) - f(x)}{h} \) is the ratio of the change in the value of the function to the change in its input value.

  • \( \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

  • Wolfram Mathworld: Derivative

Reference

Lagrange Notation

LaTeX MathJSON
f'(x) ["Derivative", "f", "x"]
f\prime(x) ["Derivative", "f", "x"]
f^{\prime}(x) ["Derivative", "f", "x"]
f''(x) ["Derivative", "f", "x", 2]
f\prime\prime(x) ["Derivative", "f", "x", 2]
f^{\prime\prime}(x) ["Derivative", "f", "x", 2]
f\doubleprime(x) ["Derivative", "f", "x", 2]
f^{(n)}(x) ["Derivative", "f", "x", "n"]

ND

["ND", expr, value]

The ND function returns a numerical approximation of the partial derivative of a function expr at the point value.

\sin^{\prime}(x)|_{x=1}
\[ \sin^{\prime}(x)|_{x=1} \]
["ND", "Sin", 1]
// ➔ 0.5403023058681398

Note: ["ND", "Sin", 1] is equivalent to ["N", ["D", "Sin", 1]].

Derivative

["Derivative", expr]

The Derivative function represents the derivative of a function expr.

f^\prime(x)
\[ f^\prime(x) \]
["Apply", ["Derivative", "f"], "x"]
 
// This is equivalent to:
[["Derivative", "f"], "x"]

["Derivative", expr, n]

When a n argument is present it represents the n-th derivative of a function expr.

f^{(n)}(x)
\[ f^{(n)}(x) \]
["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.

Integrate

["Integrate", expr]

An indefinite integral, also known as an antiderivative, refers to the reverse process of differentiation.

\int \sin
\[ \int \sin \]
["Integrate", "Sin"]

["Integrate", expr, index]

\int \sin x \,\mathrm{d}x
\[ \int \sin x \,\mathrm{d}x \]
["Integrate", ["Sin", "x"], "x"]

Note The LaTeX expression above include a LaTeX spacing command \, to add a small space between the function and the differential operator. The differential operator is wrapped with a \mathrm{} command so it can be displayed upright. Both of these typographical conventions are optional, but they make the expression easier to read. The expression \int \sin x dx \(\int f(x) dx\) is equivalent.

["Integrate", expr, bounds]

A definite integral computes the net area between a function \( f(x) \) and the x-axis over a specified interval \([a, b]\). The “net area” accounts for areas below the x-axis subtracting from the total.

\int_{0}^{2} x^2 \,\mathrm{d}x
\[ \int_{0}^{2} x^2 \,\mathrm{d}x \]
["Integrate", ["Power", "x", 2], ["Tuple", "x", 0, 2]]

The notation for the definite integral of \( f(x) \) from \( a \) to \( b \) is given by:

\[ \int_{a}^{b} f(x) \mathrm{d}x = F(b) - F(a) \]

where:

  • \( dx \) indicates the variable of integration.
  • \( [a, b] \) are the bounds of integration, with \( a \) being the lower bound and \( b \) being the upper bound.
  • \( F(x) \) is an antiderivative of \( f(x) \), meaning \( F’(x) = f(x) \).

Use NIntegrate to calculate a numerical approximation of the definite integral of a function.

["Integrate", expr, bounds, bounds]

A double integral computes the net volume between a function \( f(x, y) \) and the xy-plane over a specified region \([a, b] \times [c, d]\). The “net volume” accounts for volumes below the xy-plane subtracting from the total. The notation for the double integral of \( f(x, y) \) from \( a \) to \( b \) and \( c \) to \( d \) is given by:

\[ \int_{a}^{b} \int_{c}^{d} f(x, y) \,\mathrm{d}x \,\mathrm{d}y\]

\int_{0}^{2} \int_{0}^{3} x^2 \,\mathrm{d}x \,\mathrm{d}y
\[ \int_{0}^{2} \int_{0}^{3} x^2 \,\mathrm{d}x \,\mathrm{d}y \]
["Integrate", ["Power", "x", 2], ["Tuple", "x", 0, 3], ["Tuple", "y", 0, 2]]

Explanation

Given a function \(f(x)\), finding its indefinite integral, denoted as \(\int f(x) \,\mathrm{d}x\), involves finding a new function \(F(x)\) such that \(F’(x) = f(x)\).

Mathematically, this is expressed as:

\[ \int f(x) \,\mathrm{d}x = F(x) + C \]

where:

  • \(\mathrm{d}x\) specifies the variable of integration.
  • \(F(x)\) is the antiderivative or the original function.
  • \(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.

Reference

NIntegrate

["NIntegrate", expr, lower-bound, upper-bound]

Calculate the numerical approximation of the definite integral of a function \( f(x) \) from \( a \) to \( b \).

\int_{0}^{2} x^2 \,\mathrm{d}x
\[ \int_{0}^{2} x^2 \,\mathrm{d}x \]
["NIntegrate", ["Function", ["Power", "x", 2], "x"], 0, 2]

Limit

["Limit", fn, value]

Evaluate the expression fn as it approaches the value value.

\lim_{x \to 0} \frac{\sin(x)}{x} = 1
\[ \lim_{x \to 0} \frac{\sin(x)}{x} = 1 \]
["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

["NLimit", fn, value]

Evaluate the expression fn 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.