# Different approximations for the same problem

• I
Hello I am looking at Stat Mech problem 2 from here (page 8) with solution here. I am confused about their approximations. They are all valid, but they are different. For example in part a) they use $$\frac{\partial P}{\partial x}(x+\frac{1}{2}\Delta x,t)=\frac{P(x+\Delta x,t)-P(x,t)}{\Delta x}$$ and a bit lower they use $$\frac{\partial P}{\partial x}(x,t)=\frac{P(x,t+\Delta t)-P(x,t)}{\Delta t}$$ Why would I use one over the other? If you know what answer you need, you might figure it out, but in general I think you would get a different answer if using different approximations (by a factor of 2 or something?). Also in part b) they use a Taylor series, which could have been used equally well in part a) and I am not sure why they used it here but not there.

mfb
Mentor
The second one should be a time derivative.

One might be more convenient for the following calculations. It doesn't really matter as you take the limit of ##\Delta x, \Delta t \to 0## later anyway.

In this limit,
$$\frac{\partial P}{\partial x}(x+\frac{1}{2}\Delta x,t)=\frac{\partial P}{\partial x}(x,t) = \frac{\partial P}{\partial x}(x+\Delta x,t)$$

Chestermiller
Mentor
The first finite difference approximation is 2nd order accurate in ##\Delta x##, meaning that the error is on the order of ##(\Delta x)^2##. The second finite difference approximation is 1st order accurate in ##\Delta t##, meaning that the error is on the order of ##\Delta t##. A 2nd order approximation is more accurate than a 1st order approximation.

The first finite difference approximation is 2nd order accurate in ##\Delta x##, meaning that the error is on the order of ##(\Delta x)^2##. The second finite difference approximation is 1st order accurate in ##\Delta t##, meaning that the error is on the order of ##\Delta t##. A 2nd order approximation is more accurate than a 1st order approximation.
Thank you for your reply! I remember we studied this in a numerical method class. However, why wouldn't one stick to a certain approximation for both space and time?

Chestermiller
Mentor
Thank you for your reply! I remember we studied this in a numerical method class. However, why wouldn't one stick to a certain approximation for both space and time?
If you are solving a differential equation numerically like $$\frac{\partial P}{\partial t}=k\frac{\partial^2 P}{\partial x^2}$$you can get added accuracy (for free) in the x direction if you use the 2nd order formula. Sometimes (but not usually) a 2nd order approximation is used for the first derivative in the t direction also; this is called Crank-Nicholson.