N1=[1 9 5 4 3 8 4 8 5 6 0 3 4 0 5 3 2 4 5 6 ]; % to mean 19543848560340532456 N2=[2 3 4 3 2 3 4 5 4 8 6 4 7 8 9 7 6 5 3 2 1 4 6 7 9 ];% stands for 2343234548647897653214679
These numbers are to big to be represented exactly in MATLAB®. Your task is to write code that follows the rules of addition (adding from smallest to largest) and gets the precise answer, in the same format (that is an array of integers). There are various limitations that need to be discussed:
+. You will still need to be crafty about how you find the "ones'' and "tens'' of a given number. Since MATLAB is good with lists, think how you can use a list to do this. You may not use high level functions like mod, rem etc. (But you are encouraged to familiarize yourself with them.)+1 as the only "allowed'' arithmetic operation (because MATLAB's index of lists starts from 1 and not 0).1./[1 2 4] is [1 .5 .25]. Similarly with .*. Calculate \(\pi\) by this really (really) bad way: For a large \(N\) calculate \(\sum_{n=1}^N\frac{1}{n^2}\). This converges to \(\pi^2/6\) as \(N\rightarrow\infty\). Calculate \(\pi\) using this and find out how large \(N\) must be for the resulting value of \(\pi\) to be within 1e-6 of the MATLAB value pi.