Antidifferentiation is the process of, given a function $$f(x)$$, finding another function $$F(x)$$ whose derivative is the given function, $$\frac{d}{dx} F(x) = F^\prime(x) = f(x)$$. Antidifferentiation and the antiderivative are part of a larger process called integration.

Formally, the antiderivative of $$f(x)$$ is the set of functions $$F(x) + C$$ such that

$\frac{d}{dx}[F(x) + C] = f(x)$

where $$C$$ is what’s called the constant of integration. This can be restated as follows: if two functions $$F(x)$$ and $$G(x)$$ have the same derivative $$f(x)$$, then $$F(x)$$ and $$G(x)$$ differ by at most a constant $$F(x) = G(x) + C$$. If $$F(x)$$ is an antiderivative of a function $$f(x)$$, we write

$\int f(x)dx = F(x) + C$

meaning that the “antiderivative of $$f(x)$$, with respect to $$x$$, is the set of functions $$F(x) + C$$”. This expression is called an indefinite integral.

Differentiation (and the derivative) is how you find the rate of change of a function at a given point. Antidifferentiation, or integration, (and the antiderivative) is how you go from a derivative back to the function it came from.

As an example, if you determine that the marginal cost, $$C^\prime$$, of producing the $$x$$th unit of a product is given by $$C^\prime(x) = x^3 - 2x$$, then you can “antidifferentiate” to find the total cost (which is the orginal function).

from sympy import *
from sympy.abc import x

marginal_cost = x ** 3 - 2 * x
cost = integrate(marginal_cost, x)
cost
## x**4/4 - x**2

sympy doesn’t return the constant of integration, which is how the indefinite integral looks like in its complete form.

$$C$$ may be of interest in some applications in which we may specify a point that is a solution of the antiderivative, such point is called an initial condition.

## Height of a Thrown Object

A rock is thrown directly upward with an initial velocity of 50 ft/sec from an initial height of 10 ft. The velocity of this rock is modeled by $$v(t) = -31t + 50$$, where $$t$$ is in secondsm $$v$$ in feet per second, and $$t = 0$$ represents the moment the rock is released.

1. Determine a distance function $$h$$ as a function of $$t$$.
2. Determine the height and the velocity of the rock after 3 sec.
from sympy.abc import t
C = symbols("C")

velocity = -32 * t + 50
height = integrate(velocity, t) + C
height 
## C - 16*t**2 + 50*t

The constant of integration $$C$$ can be determined by using the initial conditions; we know that the initial height is 10 ft when $$t = 0$$.

equation = Eq(10, height)
equation
## Eq(10, C - 16*t**2 + 50*t)
constant = solve(equation, C).evalf(subs={t:0})
velocity.evalf(subs={t:3})
## -46.0000000000000
height.evalf(subs={t:3, C:constant})
## 16.0000000000000

## Change in Population

The rate of change of the population of Phoenix, Arizona, is modelled by the exponential function $$P^\prime(t) = 11.7e^{0.026t}$$, where $$t$$ is the number of years since 1960 and $$P^\prime(t)$$ is in thousands of people per year. In 1980, Phoenix had a population of 790,000.

1. Find the population model $$P(t)$$.
2. Estimate the population in 2012.
from math import e

dPdt = 11.7 * e **(0.026 * t)
integ = integrate(dPdt, t) + C
integ
## 450.0*2.71828182845905**(0.026*t) + C
initial_conditions = Eq(790, integ)
initial_conditions
## Eq(790, 450.0*2.71828182845905**(0.026*t) + C)
constant = solve(initial_conditions, C).evalf(subs={t:20})
constant
## 33.0875576355005
time_delta = 2012 - 1960

population = integ.subs(C, constant)
population
## 450.0*2.71828182845905**(0.026*t) + 33.0875576355005
population.evalf(subs={t:time_delta})
## 1772.40420342536