• Write code to plot f(x, y) versus 8. Let & range from single precision epsilon to double precision epsilon. Also plot the upper and lower bounds from thefirst part.• Come up with a different...


Let the function f(x, y) = Vx - Vy.<br>Fix y = 1 and let x = 1+ 8,, & small but greater than machine e.<br>• Show that<br>P S(x, y) ><br>• Write code to plot f(x, y) versus 8. Let & range from single precision epsilon to double precision epsilon. Also plot the upper and lower bounds from the<br>first part.<br>• 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.<br>In [1): #To get you started!<br>import numpy as np<br>import matplotlib.pyplot as plt<br>def f(x, y) :<br>#simple python function<br>return np.sqrt (x) -np. sqrt (y)<br>N=np.arange (-52,-22)<br>print (N) #Note where N stops!<br>delta-np.power (2.0, N) #The 2.0 is needed, try without!<br>print (delta)<br>fxy=f (1+delta, 1) #Why does this work?<br>[-52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35<br>-34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23]<br>[2.22044605e-16 4.44089210e-16 8.88178420e-16 1.77635684e-15<br>3.55271368e-15 7.10542736e-15 1.42108547e-14 2.84217094e-14<br>5.68434189e-14 1.13686838e-13 2.27373675e-13 4.54747351e-13<br>9.09494702e-13 1.81898940e-12 3.63797881e-12 7.27595761e-12<br>1.45519152e-11 2.91038305e-11 5.82076609e-11 1.16415322e-10<br>2.32830644e-10 4.65661287e-10 9.31322575e-10 1.86264515e-09<br>3.72529030e-09 7.45058060e-09 1.49011612e-08 2.98023224e-0s<br>5.96046448e-08 1.19209290e-07]<br>In [1]: plt.plot (delta, fxy)<br>NameError<br>Traceback (most recent call last)<br><ipython-input-1-055c5392£257> in cmodule><br>----><br>plt.plot (delta, fxy)<br>NameError: name 'plt' is not defined<br>

Extracted text: 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 S(x, y) > • Write code to plot f(x, y) versus 8. Let & 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-0s 5.96046448e-08 1.19209290e-07] In [1]: plt.plot (delta, fxy) NameError Traceback (most recent call last) in cmodule> ----> plt.plot (delta, fxy) NameError: name 'plt' is not defined
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here