I have written a code in which I find the approximation of the solution of this elliptic problem.
I calculated the error using the following part of code:
but I get the following errors for $a=-1, b=1, k_1=k_2=1$ :
For N=10: er = 9.9920e-016
For N=20: er = 2.4425e-015
For N=30: er = 7.1054e-015
For N=40: er = 7.7716e-015
For N=50: er = 1.5765e-014
For N=60: er = 1.6764e-014
For N=70: er = 1.0436e-014
But the error should decrease while $N$ increases. What have I done wrong at the code above?
EDIT:Using this code: http://pastebin.com/crS4vb1t
I get the following results:
[rate,Error]=order
rate =
0.2221 -2.0880 -0.2637 -2.7620
Error =
1.0e-014 *
0.0281 0.0241 0.1024 0.1230 0.8342
EDIT 2:
For $N=4$, $k_1=k_2=1$ the matrix A, with the code that I have written, is the following:
A =
Columns 1 through 14
-4 1 0 0 1 0 0 0 0 0 0 0 0 0
1 -4 1 0 0 1 0 0 0 0 0 0 0 0
0 1 -4 1 0 0 1 0 0 0 0 0 0 0
0 0 1 -4 0 0 0 1 0 0 0 0 0 0
1 0 0 0 -4 1 0 0 1 0 0 0 0 0
0 1 0 0 1 -4 1 0 0 1 0 0 0 0
0 0 1 0 0 1 -4 1 0 0 1 0 0 0
0 0 0 1 0 0 1 -4 0 0 0 1 0 0
0 0 0 0 1 0 0 0 -4 1 0 0 1 0
0 0 0 0 0 1 0 0 1 -4 1 0 0 1
0 0 0 0 0 0 1 0 0 1 -4 1 0 0
0 0 0 0 0 0 0 1 0 0 1 -4 0 0
0 0 0 0 0 0 0 0 1 0 0 0 -4 1
0 0 0 0 0 0 0 0 0 1 0 0 1 -4
0 0 0 0 0 0 0 0 0 0 1 0 0 1
0 0 0 0 0 0 0 0 0 0 0 1 0 0
Columns 15 through 16
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 0
0 1
0 0
1 0
-4 1
1 -4
EDIT: Here is the log-log graph of the errors in relation to $N$:
So the errors can't be right. Or am I wrong?