Exercises

Ex. 1 → Implement a method __add__, which constructs a new polynomial p+q by adding two given polynomials p and q. In monomial form, polynomials are added by just adding the coefficients, whereas in Newton form, the coefficients depend on the abscissa xi of the interpolation points. Before adding the coefficients of both polynomials, the polynomial q has to get new interpolation points with the property that their abscissa xi coincides with those of p and the method __changepoints__ has to be provided for that. It should change the interpolation points and return a new set of coefficients.

Ex. 2 → Write conversion methods to convert a polynomial from Newton form into monomial form and vice versa.

Ex. 3 → Write a method called add_point that takes a polynomial q and a tuple (x,y) as parameters and returns a new polynomial that interpolates self.points and (x,y).

Ex. 4 → Write a class called LagrangePolynomial that implements polynomials in Lagrange form and inherits as much as possible from the polynomial base class.

Ex. 5 → Write tests for the polynomial class.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.152.198