Individual Assignment A1This assessment is marked out of 35 and comprises 30% of the final course mark.Due by 1700 on Thursday week 8.Academic misconductThe assessment is primarily summative in nature. You are expected to be aware of and abide by University policies on academic misconduct.School of Mathematics academic misconduct advice and policiesAcademic Services academic misconduct informationThis is an individual assignment – do not copy the work of another student.If you use any resources (e.g. textbooks or websites) then include appropriate references in your solutions. Course materials do not need to be referenced.MarkdownIn workshops you have edited Jupyter Notebook code cells. Cells can also contain formatted text in markdown cells. Some questions ask for further discussion and explanation, which should be provided in appropriate markdown cells. You may wish to use formatting features of markdown cells, although this is optional.Jupyter Notebook: Markdown cellsYou can edit markdown cells (e.g the cell initially containing Discussion for question 1.1 in question 1) by double clicking on them, and render the markdown by selecting the cell and pressing Shift+Return.Code commentaryYour code should be extensively commented, with the functionality of each line of code explained with a comment. This is to test your understanding of the code you have written. Up to half of the marks associated with the coding part of a question may be deducted for a missing, incomplete, or inaccurate code commentary.The following provides an example of the expected level of commenting.In [ ]:def is_prime(n): Return whether an input positive integer is prime. if n == 1: # If n is 1 … return False # … then n is not prime for i in range(2, n): # Test integers i from 2 to n – 1 inclusive if n % i == 0: # If n is divisible by i … return False # … then n is not prime # If n is not divisible by any integers from 2 to n – 1 inclusive then n is # prime return TrueOutput and figuresYour code must generate and display all relevant output when run, and all figure formatting must be performed programmatically and not via the interactive plotting interface.Rerun your code cells after editing your code, to make sure that the output is updated.Saving your workWhen you edit the notebook, before closing the window/tab make sure to select File->Save and Checkpoint. If using Noteable make sure you also download and keep a copy of the edited file, using File->Download as->Notebook.On lab computers make sure you save edited notebook files in an appropriate location, as otherwise they may be lost when you logout.Information Services: Saving your filesQuestion 1: Numerical linear algebraThis question is based on question 1.8 in chapter 1 ofNumerical Computing with MATLAB, C. Moler, 2004Consider the matrix$$Q = \left( \begin{array}{cc} 1 & 1 \\ 1 & 0 \end{array} \right).$$1.1 Investigate what you obtain when $Q$ is multiplied by itself $n$ times. Can you identify any other properties of the matrix Q?Your code should display output that is easy to interpret and understand. Summarise and explain your results in a discussion of no more than $250$ words.[6 marks]In [ 代写Assignment A1作业、代做MATLAB程序设计作业、MATLAB语言作业代写、代做Mathematics作]:# Code for question 1.1Discussion for question 1.1Question 2: Interpolation and fittingThe following data are taken from T. A. Boden, G. Marland, R. J. Andres, Global, regional, and national fossil-fuel CO? emissions. Carbon Dioxide Information Analysis Center, Oak Ridge National Laboratory, U.S. Department of Energy, Oak Ridge, Tennessee, U.S.A., 2017, doi:10.3334/CDIAC/00001_V2017.?CDIAC: Global fossil fuel CO? emissionsThese provide estimates of global CO? emissions from 2004 to 2014 inclusive, in millions of tons of carbon.YearEmissions2004 7743 2005 8042 2006 8336 2007 8503 2008 8776 2009 8697 2010 9128 2011 9503 2012 9673 2013 9773 2014 9855 2.1 Plot1.A scatter plot of the original data.2.An interpolating polynomial fitting through the data.3.A degree five least squares fitting polynomial, fitting the data in a least squares sense as described in the week 6 lecture and workshops.4.A cubic spline through the data generated using scipy.interpolate.CubicSpline provided with SciPy.5.A cubic spline through the data generated using scipy.interpolate.PchipInterpolator provided with SciPy.You should choose how to present the plots so that the data presentation is clear and easy to understand.[7 marks]In [ ]:# Code for question 2.12.2 Which do you think provides a more useful fit to the data? Justify your answer using no more than $350$ words.[5 marks]Discussion for question 2.2Question 3: Gaussian elimination3.1 Write a function named eliminate_super_diagonal which accepts two input arguments1.an $N \times N$ real (floating point) matrix $A$ for which $A_{j + 1,j + 1} \ne 0$, with $N \ge 1$,2.an index $j$, where $j \in \left\{ 0, \ldots, N – 1 \right\}$,and applies elementary row operations to eliminate all entries above the main diagonal in the $\left( j + 1 \right)$th column of $A$ (where here the rows and columns of $A$ are referred to indexing from one).That is, on returning from the function, all elements in $A$ from row $\left( j + 1 \right)$ to row $N$ should be left unchanged, while elementary row operations are applied so that, on returning from the function, $A_{k,j + 1} = 0$ for all $k Hint: Functions can modify arrays in-place, changing the values of elements and without first creating a copy, e.g.import numpy as npdef increment_element(A, i, j): A[i, j] += 1.0R = np.ones([10, 10])# R[5, 5] equals oneincrement_element(R, 5, 5)# R[5, 5] now equals two[4 marks]In [ ]:# Code for question 3.13.2 Write a function named gaussian_elimination which accepts an input square matrix $A$, of size $N\times N$, and applies elementary row operations to $A$ to obtain a lower triangular matrix. You should decide how to handle division-by-zero problems, and explain your decision.You may wish to consider how your gaussian_elimination function handles the matrix$$A = \left( \begin{array}{ccc} 1 & 1 & 1 \\ 3 & 1 & 0 \\ 2 & 1 & 0 \end{array} \right).$$[7 marks]In [ ]:# Code for question 3.2Discussion for question 3.23.3 How does the cost of gaussian_elimination increase as $N$ increases? Justify your answer, including numerical tests, and a discussion of no more than $250$ words.[6 marks]In [ ]:# Code for question 3.3Discussion for question 3.3转自：http://ass.3daixie.com/2019021676270058.htmlhttps://www.jianshu.com/p/43868f42f0c8

# 讲解：Assignment A1、MATLAB、MATLAB、MathematicsMatlab|Web

「点点赞赏，手留余香」

还没有人赞赏，快来当第一个赞赏的人吧！