Question: code in pytorch Use torch and matplotlib for the following 1. A second order forward approximation to the derivative is f(x + 2h) - 4f(x+h)

code in pytorch code in pytorch Use torch and matplotlib for the following 1. A

Use torch and matplotlib for the following 1. A second order forward approximation to the derivative is f(x + 2h) - 4f(x+h) + 3f (r) $' (r) = +O(12) 2h (a) Given a function sampled at f = [f(x0), f(x1),..., f(In-1)] write a function that approxi- mates the derivatives at points (-0,21,..., In-3) and uses this approximation. (b) Design and execute testing that show that the code works as the theory predicts. 2. In this question you will derive an approximation for the second derivative pf 5. L) (a) Write the Taylor's expansion for f(x + h) around f using the first 4 terms f(a+h) = f(x) + ... (b) Write the Taylor's expansion for f(x-h) around / using the first 4 terms f(x+h) = f(x) - ... (c) Add the equations (d) Isolate S"() (e) What is the order of the approximation? Use torch and matplotlib for the following 1. A second order forward approximation to the derivative is f(x + 2h) - 4f(x+h) + 3f (r) $' (r) = +O(12) 2h (a) Given a function sampled at f = [f(x0), f(x1),..., f(In-1)] write a function that approxi- mates the derivatives at points (-0,21,..., In-3) and uses this approximation. (b) Design and execute testing that show that the code works as the theory predicts. 2. In this question you will derive an approximation for the second derivative pf 5. L) (a) Write the Taylor's expansion for f(x + h) around f using the first 4 terms f(a+h) = f(x) + ... (b) Write the Taylor's expansion for f(x-h) around / using the first 4 terms f(x+h) = f(x) - ... (c) Add the equations (d) Isolate S"() (e) What is the order of the approximation

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!