Let the function f(x, y) = Vx - Vy. Fix y = 1 and let x = 1+ 8, & small but greater than machine e. • Show that P f(x, y) 2 . 2+ 8 • Write code to plot f(x, y) versus 8. Let 8 range from single precision epsilon to double precision epsilon. Also plot the upper and lower bounds from the first part. • Come up with a different arithmetic set of operations that gives you the same f(x, y) but is more accurate. Plot this function for the same range of 8. In [1): #To get you started! import numpy as np import matplotlib.pyplot as plt def f(x, y): #simple python function return np.sqrt (x) -np. sqrt (y) N-np.arange (-52,-22) print (N) #Note where N stops! delta-np.power (2.0,N) #The 2.0 is needed, try without! print (delta) fxy=f (1+delta, 1) #Why does this work? [-52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23) [2.22044605e-16 4.44089210e-16 8.88178420e-16 1.77635684e-15 3.55271368e-15 7.10542736e-15 1.42108547e-14 2.84217094e-14 5.68434189e-14 1.13686838e-13 2.27373675e-13 4.54747351e-13 9.09494702e-13 1.81898940e-12 3.63797881e-12 7.27595761e-12 1.45519152e-11 2.91038305e-11 5.82076609e-11 1.16415322e-10 2.32830644e-10 4.65661287e-10 9.31322575e-10 1.86264515e-09 3.72529030e-09 7.45058060e-09 1.49011612e-08 2.98023224e-08 5.96046448e-08 1.19209290e-07] In [1): plt.plot (delta, fxy) NameError in cmodule> ----> 1 plt.plot (delta, fxy) Traceback (most recent call last) NameError: name 'plt' is not defined
Let the function f(x, y) = Vx - Vy. Fix y = 1 and let x = 1+ 8, & small but greater than machine e. • Show that P f(x, y) 2 . 2+ 8 • Write code to plot f(x, y) versus 8. Let 8 range from single precision epsilon to double precision epsilon. Also plot the upper and lower bounds from the first part. • Come up with a different arithmetic set of operations that gives you the same f(x, y) but is more accurate. Plot this function for the same range of 8. In [1): #To get you started! import numpy as np import matplotlib.pyplot as plt def f(x, y): #simple python function return np.sqrt (x) -np. sqrt (y) N-np.arange (-52,-22) print (N) #Note where N stops! delta-np.power (2.0,N) #The 2.0 is needed, try without! print (delta) fxy=f (1+delta, 1) #Why does this work? [-52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23) [2.22044605e-16 4.44089210e-16 8.88178420e-16 1.77635684e-15 3.55271368e-15 7.10542736e-15 1.42108547e-14 2.84217094e-14 5.68434189e-14 1.13686838e-13 2.27373675e-13 4.54747351e-13 9.09494702e-13 1.81898940e-12 3.63797881e-12 7.27595761e-12 1.45519152e-11 2.91038305e-11 5.82076609e-11 1.16415322e-10 2.32830644e-10 4.65661287e-10 9.31322575e-10 1.86264515e-09 3.72529030e-09 7.45058060e-09 1.49011612e-08 2.98023224e-08 5.96046448e-08 1.19209290e-07] In [1): plt.plot (delta, fxy) NameError in cmodule> ----> 1 plt.plot (delta, fxy) Traceback (most recent call last) NameError: name 'plt' is not defined
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
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Recommended textbooks for you
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…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
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)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY