代写Assignment 1 - FIT3139帮做Python编程
- 首页 >> Java编程Assignment 1 - FIT3139
Due: Monday 11:55pm on Week 5
worth 15% of your final mark
March 8, 2024
This assignment covers content taught in weeks 1-3. You may use any of the following programming languages: Julia. Python or MATLAB.
You can present your report as a PDF, including the code separately or you can use a Jupyter notebook containing the report and the code. It is in your best interest for us to understand easily what you are doing in the code and the report. Take your time ensuring the report and the code are readable and easy to understand.
For marking each task we will look at:
. Code correctness
. Quality of plots and figures
. Quality of analysis
[ ]:
Part 1 - Model Error (7.5 marks total)
Part 1.1 (3 marks)
Consider the following function f(x) = cos(x).
This function can be expressed equivalently using an infinite Taylor Series, but since our finite precision machines cannot evaluate the infinite Taylor Series, we must content ourselves with truncating the Taylor Series after a finite number of terms and accept a level of error.
Implement a function which approximates cos(x) using a truncated Taylor Series around the point 0. Compare the accuracy of this function to the inbuilt cos(x) function. Make this comparison for different levels of accuracy and for different points of interest in the domain.
Plot and explain your results.
[ ]:
Part 1.2 (1.5 marks)
The small angle theorem states that for sufficiently small values of x
cos(x) = 1 − 2/x2
How small should x be for this to hold, given a tolerance of a 0.01% relative error? Using plots and a description explain your results.
[ ]:
Part 1.3 (3 marks)
Repeat parts 1.1 and 1.2 using the tan(x) function. Explain your results using a description and plots.
[ ]:
Part 2 - Data Error (3 marks total)
The number π is a trascendental number, and cannot be stored in a finite precision machine. As a result, it is rounded after a finite number of decimal places.
Explore how the accuracy of the function f(x) = cos(2πx) is affected by rounding π to various degrees of precision. Assume that your computer’s inbuilt π value is a sufficiently accurate approximation of π .
Using plots and a description explain your results.
[ ]:
Part 3 - Sensitiviy and condition number (4.5 marks total)
Evaluate the sensitivity of the function f(x) = cos(2πx) function in two ways. First, by computing the relative forward and relative backward errors and inspecting their ratio. Sec- ond, by using the approximation formula that relies on the derivative off. Explore different regions of the domain.
Let us assume the following sources of error:
. We approximate the cos function by truncating the taylor series after the first non-zero term.
. The input x is rounded to 3 significant figures.
Using plots and a description, explain your results.
[ ]: