Polynomials are among the simplest functions in mathematics and are defined as a sum:
x represents a placeholder to be substituted, and ai is a number. Since polynomials are simple, they provide an excellent means for a brief introduction to calculus. Calculus concerns the differentiation and integration of functions. Integration is, roughly speaking, anti-differentiation, in the sense that first integrating and then differentiating yields the original function.
In this recipe, we will define a simple class that represents a polynomial and write methods for this class to perform differentiation and integration.
Getting ready
Geometrically, the derivative, obtained by differentiating, of a function is its gradient, and the integral, obtained by integrating, of a function is the area that lies between the curve of the function and the x axis, accounting for whether the curve lies above...