Data Store Blog
Explore the latest insights, tutorials, and updates in web scraping, Python automation, and data mining—tailored for small businesses and data-driven entrepreneurs. Our blog empowers you to stay ahead of the curve, unlocking faster workflows and smarter decision-making through cutting-edge automation techniques.
Categories
- ACC 543
- Accounting
- Biology
- Business
- C Programming
- C++
- Calculus
- Chemical Engineering
- Chemistry
- Civil Engineering
- Communication
- Computer Science
- Computer Science
- CPT 341 Spring 2020
- Discussion
- Ecomonic
- Education
- Electric Engineering
- Engineering
- English
- Environmental Science & Engg
- Essay
- Excel
- Finance
- Health
- healthcare
- History
- Information Systems
- Introduction to sociology 2nd edition
- Java
- Java
- Law
- Mathematics
- Mechanical Engineering
- Men's Fashion
- NATV 1220
- Nursing
- Nutrition
- Operations Management
- Physics
- Programming
- PSYC 325 Final Exam
- Psychology
- Psychology
- Python
- Research Paper
- Social Sciences
- Statistics
- Statistics and Probability
- Uncategorized
- Visual Basic.NET
- Women's Fashion
1 Write a function which takes a list of the coefficients of a polynomial Pxa0a1xa2x2anxn
(1) Write a function which takes a list of the coefficients of a polynomial P(x) = a0 + a1x + a2x^2 + … + anx^n of arbitrary degree n, and a value of x0, and returns P(x0). You can use the function given in lectures, ensuring you understand how it works.
(2) Use the function to evaluate (a) P1(x) = 4x^4 + 3x^2 + 2 at x = 2. (b) P2(x) = 241x^4 at x = 2. Are these answers exact? Explain why or why not. (Use a print statement to show the evaluation of your function, and answer the question in a comment.)
(3) The power series for the sine function sin(x) is given by sin(x) = Σ (1)^n * (2n+1)! * x^(2n+1) = x – x^3/3! + x^5/5! – x^7/7! + …, for all x. Use the first four terms in this series in the Horner evaluation function at a suitable value of x to give an approximation of sin(π/4).
(4) (a) Use your Horner’s method function to evaluate the polynomial (x-1)^3 at the point x = 1.000001. (b) Is this answer correct? (c) Briefly explain why or why not.
(5) In week 3 we wrote a function to convert from binary to decimal. This can be adapted to other bases; here we will explore octal (base 8). The efficiency of the function we wrote can be improved using the same principle as Horner’s method. Write such a function (horner_octal_to_dec) using the ideas of Horner’s method which takes a list whose entries are integers between 0 and 7, where the list represents a base-8 number, and returns the corresponding decimal integer (so the input [2,5,1] returns the integer 169).