Question: how to use python to do this question? Problem 4 (7 points) Consider the integral dt (a) (2 points) Find an upper bound lf(x1 K2

how to use python to do this question? Problem 4 (7 points)how to use python to do this question?

Problem 4 (7 points) Consider the integral dt (a) (2 points) Find an upper bound lf"(x1 K2 for x E [ 1, oo) wheref(x) = e-x/r. Save the value as K2 . In [ ]: | # Use the variable name K2 # YOUR SOLUTION GOES HERE In [ ]. assert shal(str(K2).encode('utf8')).hexdigest() == '042bb56f0af253c4571e3218a4cbbcca22176a75, "That is not the expected value." print("Problem 4 Test 1: Success!") (b) (5 points) Write a function called Ei which takes input parameters b and max error and returns the approximation of the integral dt given by the trapezoid method with N subintervals which guarantees the error is less than max_error In(): # YOUR SOLUTION GOES HERE def Ei(b,max error): In [: "Check that Ei returns the correct type." assert type(Ei(2,0.001))--np.float64 print( Problem 4 Test 2: Success!") In [: "Check that Ei returns the correct values." print("Problem 4 Test 3: Success!") In [: "Check that Ei returns the correct values." assert Ei(1,0.01)0 epsilon-10e-14 assert abs(Ei(5,0.001)-0.21833350347126337) epsilon Problem 4 (7 points) Consider the integral dt (a) (2 points) Find an upper bound lf"(x1 K2 for x E [ 1, oo) wheref(x) = e-x/r. Save the value as K2 . In [ ]: | # Use the variable name K2 # YOUR SOLUTION GOES HERE In [ ]. assert shal(str(K2).encode('utf8')).hexdigest() == '042bb56f0af253c4571e3218a4cbbcca22176a75, "That is not the expected value." print("Problem 4 Test 1: Success!") (b) (5 points) Write a function called Ei which takes input parameters b and max error and returns the approximation of the integral dt given by the trapezoid method with N subintervals which guarantees the error is less than max_error In(): # YOUR SOLUTION GOES HERE def Ei(b,max error): In [: "Check that Ei returns the correct type." assert type(Ei(2,0.001))--np.float64 print( Problem 4 Test 2: Success!") In [: "Check that Ei returns the correct values." print("Problem 4 Test 3: Success!") In [: "Check that Ei returns the correct values." assert Ei(1,0.01)0 epsilon-10e-14 assert abs(Ei(5,0.001)-0.21833350347126337) epsilon

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!