Would it ever be acceptable to omit the constant of integration? Particularly in coding.

65 Views Asked by At

In my coding (python if that makes a difference) lecture we have been given a recursive definition for a sequence a(n), and then given f(x) = a(n) + a(n)^2 + a(n)^3 and asked to integrate it. In the examples the lecturer gave throughout the lecture they didn't always add a constant of integration, and when asked if we should include one he gave a vague answer as to make us think. He said we add a constant in mathematics when trying to describe the family of functions that when differentiated would give a specific set of functions.

I'm in two minds. I'm thinking maybe we shouldn't include a constant because we aren't integrating again so the constant wouldn't change anything and differentiating nothing and differentiating gives the same result. But also surely we should include a constant, or at least shouldn't be penalised for including one because that's the rules of mathematics

*edit, i forgot to say the integral is an indefinite integral

3

There are 3 best solutions below

2
On

The difference is between definite and indefinite integrals. Consider $$\int f(x)\,dx =F(x)+C$$ and you must put the $C$. Now $$\int_a^b f(x)\,dx =\left( F(b)+C\right)-\left( F(a)+C\right)=F(b)-F(a)$$

Is this clear ?

0
On

A reason why it is important to add a constant when we compute primitives: consider $$I:=\int\frac{1}{t\ln(t)}\mathrm{d}t.$$ Using the (rough version of) integration by parts formula $\int u'v=uv-\int uv'$ with $u'(t)=\frac{1}{t}$ and $v(t)=\frac{1}{\ln(t)}$, we get: $$I=1-\int\frac{\ln(t)}{-\ln^2(t)}\frac{1}{t}\mathrm{d}t=1+I.$$ We "conclude" that $0=1$, which is true modulo an additive constant.

So we can do our computations without writing the constant, but we have to keep in mind that the result has to be understood modulo an additive constant.

0
On

There are many ways we can interpret the statement $$ \int f(x) \, dx = F(x)+C \, . $$ In some treatments of calculus, all this means is that $\frac{d}{dx}\left(F(x)+C\right)=f(x)$, in which case the constant of integration is not strictly necessary. But often, $\int f(x) \, dx$ refers to a set of antiderivatives (i.e. a set of functions whose derivative is $f(x)$). This is what your lecturer was probably referring to. If antiderivatives are treated more formally, then writing $$ \int f(x) \, dx = F(x) $$ is just incorrect, even if people understand what you mean.

Although the constant of integration is often just an annoyance, there are cases when not writing it can cause problems (see Nicolas' answer). However, sometimes, you might only require one antiderivative (e.g. when trying to compute (definite) integrals). Although it is correct to write $$ \int_{a}^{b} f(x) \, dx = (F(b)+C)-(F(a)+C)=F(b)-F(a) \, , $$ it is not necessary to write in a constant of integration, since it will be cancelled anyway. Since you only require one antiderivative to compute the integral, why not choose the simplest one?