Order of accuracy

Hi all, here is a plot showing the error I computed for my Poisson solver.

The equation it is solving is:

Laplacian(u) = -Pi*ex*[Pi*ex *Cos(Pi*ex) + Sin(Pi* ex)]

The analytic solution is u = Cos(Pi*ex)

I calculated the error for different dx, using E = uapprox - uexact

where uapprox is the numerical solution at x=0 and uexact is the exact solution at x=0 (=-1)

The error is supposed to go like:

E ~ (dx)n

where n is the order of accuracy.

After computing E for the different dx, I plotted it against what a 1st, 2nd, 3rd order accurate scheme would produce for the given step-size dx:

This seems wonky. The trend seems to start out near 2nd order accurate, but as I reduce dx, it begins to diverge from it. This is the opposite of what I would expect to happen… :(

I increased the zones in the following sequence, (25, 50, 100, 200, 400, 800), and computed the error at a fixed x=0. I wonder if changing x would give better results… either a different fixed position along u, or a fluctuating position, where the tolerance criteria was minimized…

*UPDATE*

Okay, so I checked in 3 different norms whether this trend still happens, and I see it still… Basically it seems to be 2nd order until the resolution gets small, where the error begins to increase..

Attachments (4)

Download all attachments as: .zip

Comments

1. Jonathan -- 11 years ago

Let Y_i be your solution and let E_i be the exact Then your error can be found by calculating <|Y-E|> where <X> = sum(x)/N where N is the number of elements…

You can also calculate sqrt(<(Y-E)2>) which is the root mean square…

Or you can generalize to any power L_N = (<(|Y-E|)N>)(1/N)

So the root mean square is the L2 norm, and the average absolute error is the L1 norm.

As N gets large, only the largest difference will matter - and this just gives you max(|Y-E|)

So the max function is like the L_infinity norm

2. Jonathan -- 11 years ago

I would plot the L2 or the L_infinity norm as a function of resolution…