Exercise 4B (1) Write a function which takes a list of the coefficients of a polynomial P(x) = ª₁ + ª₁x + a² + ... + anxn of arbitrary degree n, and a value of xo, and returns P(xo). You can use the function given in lectures, ensuring you understand how it works.
Exercise 4B (1) Write a function which takes a list of the coefficients of a polynomial P(x) = ª₁ + ª₁x + a² + ... + anxn of arbitrary degree n, and a value of xo, and returns P(xo). You can use the function given in lectures, ensuring you understand how it works.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Exercise 4B
(1) Write a function which takes a list of the coefficients of a polynomial
P(x) = ª₁ + ª₁x + a² + …..
+anxn
of arbitrary degree n, and a value of x, and returns P(x). You can use the function given in lectures,
ensuring you understand how it works.
(2) Use the function to evaluate
(a) P₁(x) = 4x4 + 3x² + 2 at x = 2.
(b) P₂(x) = 2 — ¹x¹ at x = √√/2.
Are these answers exact? Explain why or why not.
(Use a print statements 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
∞
x2n+1
(2n + 1)!
sin(x) = Σ(−1)”.
n=0
= x
6
+
x5
120
for all x. Use the first four terms in this series in the Horner evaluation function at a suitable value of a to
give an approximation of sin(π/4).
(4) (a) Use your Horner's method function to evaluate the polynomial (x − 1)³ 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 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).](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fed029406-a1c1-473f-a3a0-6fd0fbd8e89d%2Ffb803bb2-8cd8-43d5-864c-57f826136fa7%2Fvhkxucu_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Exercise 4B
(1) Write a function which takes a list of the coefficients of a polynomial
P(x) = ª₁ + ª₁x + a² + …..
+anxn
of arbitrary degree n, and a value of x, and returns P(x). You can use the function given in lectures,
ensuring you understand how it works.
(2) Use the function to evaluate
(a) P₁(x) = 4x4 + 3x² + 2 at x = 2.
(b) P₂(x) = 2 — ¹x¹ at x = √√/2.
Are these answers exact? Explain why or why not.
(Use a print statements 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
∞
x2n+1
(2n + 1)!
sin(x) = Σ(−1)”.
n=0
= x
6
+
x5
120
for all x. Use the first four terms in this series in the Horner evaluation function at a suitable value of a to
give an approximation of sin(π/4).
(4) (a) Use your Horner's method function to evaluate the polynomial (x − 1)³ 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 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).
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY