George Mason University



Conor Philip Nelson

Source: Home > Classes > Math 447 > Project 1 > Step 3

Math 447: Numerical Analysis

Project 1 Step 1: Step 2: Step 3: Step 4: Step 5: Step 6: Step 7:


3. Rerun the calculation in step 1 for \(n=10*2^k\), where \(k=1,...,11\). Make a table of the at \(x=L\) for each \(n\). For which \(n\)is the error smallest? Why does the error begin to increase with \(n\) after a certain point? You may want to make an accompanying table of condition number of \(A\) as a function of \(n\) to help answer the last question. To carry out this step for large \(k\), you may need to ask Matlab to store the matrix \(A\) as a sparse matrix to avoid running out of memory. To do this, just initialize \(A\) with the command \(A=sparse(n,n)\), and proceed as before. We will discuss sparse matrices in more detail in the next section.

Results:

The table below shows us that at \(n = 20\), our error is the smallest. As at \(n =10\) the resultant error was near machine epsilon, any more discretization of the model only produces increased error due to round-off. It can be seen that we cannot bound the error any further as the condition number of the matrix grows larger and larger as the matrix increases in size.

'n' cond(A) Errors
20 0.000000000005303 E17 0.000000000004059 E-03
40 0.000000000084493 E17 0.000000000196867 E-03
80 0.000000001348213 E17 -0.000000001338459 E-03
160 0.000000021538773 E17 -0.000000015524032 E-03
320 0.000000344346457 E17 -0.000000374602925 E-03
640 0.000005507300511 E17 -0.000000820345835 E-03
1280 0.000088098638587 E17 -0.000004269560686 E-03
2560 0.001409429170222 E17 -0.000170064631582 E-03
5120 0.022549303183856 E17 0.003796953486316 E-03
10240 0.361759978675708 E17 -0.039358200510424 E-03
20480 6.157135266133432 E17 0.496388138887952 E-03

Code for Results

Previous: Step 2 Project 1 Home Next: Step 4