MATH10001 Mathematical Workshop MATLAB Coursework 1. Given that f(x) = ecos(x) g(x) = 2 (a) (3 marks) Write a script M-file to plot y = f(x) and y = g(x) on the same axes for x between −pi 2 and 2pi. The code should label the axes. (b) (2 marks) Amend your M-file from part (a) so that it ALSO finds, to four decimal places, the first two positive solutions of f(x) = g(x). 2. (5 marks) Write a script M-file to implement the Secant method with x1 = −1.5 and x2 = −0.5 to find a solution of the equation below. Your solution should be correct to 5 decimal places and your code must not do more iterations than necessary to achieve this. Your code must output each iteration. ecos(x) = 2 3. (a) (5 marks) Write a script M-file to implement the forward difference method to estimate the gradient of y = ecos(x) − 2 at the point where x = 2. Your code should use a FOR loop to estimate this gradient three times, once using h = 0.1, once using h = 0.01 and once using h = 0.001. (b) (2 marks) Differentiate y = ecos(x)−2 by hand and use your answer to find to 7 decimal places the gradient when x = 2. 4. (5 marks) Write a script M-file to implement the mid-point rule to find the area bounded by the curve y = ecos(x) − 2, the x axis and the lines x = −0.5 and x = 0.5. Use strips of width 0.02. Project Report This project is worth 25% of the marks for MATH10001. The project report should be word-processed using LATEX and include the M-files and their outputs. There are 3 marks available for accurate LATEX. To gain all the marks, your M-files must contain comments to explain their structure and the report must be clearly presented. To gain all the marks, your code should be as efficient as possible. The project and report must be all your own work. Anyone suspected of sharing M-files or copying another student’s work will be dealt with by the Academic Malpractice Panel. Plagiarism guidance for students is linked on Blackboard and available here. You should submit your report through Blackboard by 4pm on Tuesday 5th November 2019. 1 Presenting your answers Upload a single pdf document via Blackboard and four M-files. (Question 1 can be submitted in a single m-file). The pdf should have the following form; 1. The name of the M-file for this question followed by the graph it outputs and the solutions it produces. 2. The name of the M-file for this question followed by the output. 3. a) The name of the M-file for this question followed by the output. b) Show how you did the differentiation by hand, carefully typeset in LATEX, and what the gradient is correct to 7 d.p.. 4. The name of the M-file for this question followed by the output. 2