Question: Exercise (exponential.py, test_exponential.py) Idea: Consider an exponential function . This has the curious property that its derivative is itself: . In computer science terms, this
Exercise (exponential.py, test_exponential.py)
Idea: Consider an exponential function . This has the curious property that its derivative is itself: . In computer science terms, this means that the function is a "fixed-point" of the operator. We wish to show this property numerically.
To accomplish this, complete the following subtasks:
Copy your classwork module into this repository and import it in your code module exponential.py. You will use the intervalfunction you already created.
Create a function differentiate(i, dx) in the code module that takes two parameters: i is an interval as generated by the preceding function, and dx is the spacing of each step. Have this function return the differentiation of the interval. For the interior points of the interval, use the symmetric difference formula for the derivative: [f(x+dx)-f(x-dx)]/(2dx)
. For the end-points of the interval, use the appropriate forward or backward difference formula. (Explain in your notebook why you think these definitions were chosen.) Done properly, the resulting interval should have the same number of points as the original interval.
Create a test function test_differentiate in the test module that checks a simple differentiation example for correctness.
Create a test function test_exponential_differentiation that checks whether the derivative of an interval of exp correctly approximates itself when dx is a small parameter. Show this result in your report notebook as well.
Python3 - Program that differentiates an interval

Idea: Consider an exponential function exp(x). This has the curious property that its derivative is itself: d exp(x)/dx = exp(x). In computer science terms, this means that the function exp(x) is a "fixed-point" of the d/dx operator. We wish to show this property numerically. To accomplish this, complete the following subtasks: Copy your classwork module into this repository and import it in your code module exponential.py. You will use the interval function you already created. Create a function differentiate(i, dx) in the code module that takes two parameters: i is an interval as generated by the preceding function, and dx is the spacing of each step. Have this function return the differentiation of the interval. For the interior points of the interval, use the symmetric difference formula for the derivative: df(x)/dx almostequalto [f(x + dx) - f(x - dx)]/(2dx). For the end points of the interval, use the appropriate forward or backward difference formula. (Explain in your notebook why you think these definitions were chosen.) Done properly, the resulting interval should have the same number of points as the original interval. Create a test function test_differentiate in the test module that checks a simple differentiation example for correctness. Create a test function test_exponential_differentiation that checks whether the derivative of an interval of exp correctly approximates itself when dx is a small parameter. Show this result in your report notebook as well. Ensure that your code and test modules are properly commented, and that you have correctly used docstrings to document your functions and module. Check that the python help() command correctly shows those docstrings in an interpreter. You should do this for all your python modules from now on. Make sure you complete the Jupyter notebook, paying special care to format it well, and discuss the problem in full. Imagine that you will give this notebook to a colleague later for critique on both the content and the presentation of that content. Idea: Consider an exponential function exp(x). This has the curious property that its derivative is itself: d exp(x)/dx = exp(x). In computer science terms, this means that the function exp(x) is a "fixed-point" of the d/dx operator. We wish to show this property numerically. To accomplish this, complete the following subtasks: Copy your classwork module into this repository and import it in your code module exponential.py. You will use the interval function you already created. Create a function differentiate(i, dx) in the code module that takes two parameters: i is an interval as generated by the preceding function, and dx is the spacing of each step. Have this function return the differentiation of the interval. For the interior points of the interval, use the symmetric difference formula for the derivative: df(x)/dx almostequalto [f(x + dx) - f(x - dx)]/(2dx). For the end points of the interval, use the appropriate forward or backward difference formula. (Explain in your notebook why you think these definitions were chosen.) Done properly, the resulting interval should have the same number of points as the original interval. Create a test function test_differentiate in the test module that checks a simple differentiation example for correctness. Create a test function test_exponential_differentiation that checks whether the derivative of an interval of exp correctly approximates itself when dx is a small parameter. Show this result in your report notebook as well. Ensure that your code and test modules are properly commented, and that you have correctly used docstrings to document your functions and module. Check that the python help() command correctly shows those docstrings in an interpreter. You should do this for all your python modules from now on. Make sure you complete the Jupyter notebook, paying special care to format it well, and discuss the problem in full. Imagine that you will give this notebook to a colleague later for critique on both the content and the presentation of that content
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
