Question: Python Please! 03: This is for advanced super programmer who get the above 2 problems done. Exercise 7.18. Make a class for summation of series.
Python Please!

03: This is for advanced super programmer who get the above 2 problems done. Exercise 7.18. Make a class for summation of series. Our task in this exercise is to calculate a suln S(r)-~MA(r) where f(x) is a term in a sequence which is assumed to decrease in absolute value. In class Sum, for computing S(), the constructor re- quires the following three argumentsfk(x) as a function f(k, x). M as an int object M, and N as an int object N. A _call_ method com- putes and returns S(r). The next term in the series, fN+1(), should be computed and stored as an attribute first neglected term. Here is an example where we compute S(z) 0(-x) def term(k, x): return (-x)*k S Sum(term, M-O, N-100) x -0.5 print S(x) # Print the value of the first neglected term from last S(x) comp print S.first neglected term Calculate by hand what the output of this test becomes, and use it to verify your implementation of class Sum Apply class Sum to compute the Taylor polynomial approximation for sin.r at x = . 30m and N-5, 10, 20. Compute the error and com- pare with the first neglected term fN+1(r). Present the result in nicely formatted tables. Repeat such calculations for the Taylor polynomial for e-r at x = 1.3. 5 and N = 5. 10.20. Also demonstrate how class Sum can be used to calculate the sum (3.1) on page 98 (choose 2,5, 10 and N = 5, 10.20). Formulas for the Taylor polynomials can be looked up in Exercise 5.27. Name of program file: Sum.py
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
