Challenge

Week 3.5 - Deriving 4th order approximation of a 2nd order derivative using Taylor Table method

Based on the above stencil our hypothesis equation will be:-

∂2u∂x2=af(i−2)+bf(i−1)+cf(i)+df(i+1)+ef(i+2)∂2u∂x2=af(i-2)+bf(i-1)+cf(i)+df(i+1)+ef(i+2)………………… (1)

In order to find the values of coefficient(a,b,c,d,e),(a,b,c,d,e),we’re going to use the Taylor table method. Writing Taylor series expansion for each term of equation (1) as:-

(a)f(i−2)=(a)f(i)−(a)f′(i)(2Δx)1!+(a)f′'(i)(2Δx)22!−(a)f′''(i)(2Δx)33!+(a)f′'''(i)(2Δx)44!−(a)f′''''(i)(2Δx)55!+(a)f′'''''(i)(2Δx)66!+⋯(a)f(i-2)=(a)f(i)-(a)f′(i)(2∆x)1!+(a)f′′(i)(2∆x)22!-(a)f′′′(i)(2∆x)33!+(a)f′′′′(i)(2∆x)44!-(a)f′′′′′(i)(2∆x)55!+(a)f′′′′′′(i)(2∆x)66!+⋯

(b)f(i−1)=(b)f(i)−(b)f′(i)(Δx)(1!)+(b)f′'(i)(Δx)2(2!)−(b)f′''(i)(Δx)3(3!)+(b)f′'''(i)(Δx)4(4!)−(b)f′''''(i)(Δx)5(5!)+(b)f′'''''(i)(Δx)6(6!)+⋯(b)f(i-1)=(b)f(i)-(b)f′(i)(∆x)(1!)+(b)f′′(i)(∆x)2(2!)-(b)f′′′(i)(∆x)3(3!)+(b)f′′′′(i)(∆x)4(4!)-(b)f′′′′′(i)(∆x)5(5!)+(b)f′′′′′′(i)(∆x)6(6!)+⋯

(c)f(i)=(c)f(i)(c)f(i)=(c)f(i)

(d)f(i+1)=(d)f(i)+(d)f′(i)(Δx)(1!)+(d)f′'(i)(Δx)2(2!)+(d)f′''(i)(Δx)3(3!)+(d)f′'''(i)(Δx)4(4!)+(d)f′''''(i)(Δx)5(5!)+(d)f′'''''(i)(Δx)6(6!)+⋯(d)f(i+1)=(d)f(i)+(d)f′(i)(∆x)(1!)+(d)f′′(i)(∆x)2(2!)+(d)f′′′(i)(∆x)3(3!)+(d)f′′′′(i)(∆x)4(4!)+(d)f′′′′′(i)(∆x)5(5!)+(d)f′′′′′′(i)(∆x)6(6!)+⋯

(e)f(i+2)=(e)f(i)+(e)f′(i)(2Δx)(1!)+(e)f′'(i)(2Δx)2(2!)+(e)f′''(i)(2Δx)3(3!)+(e)f′'''(i)(2Δx)4(4!)−(e)f′''''(i)(2Δx)5(5!)+(e)f′'''''(i)(2Δx)6(6!)+⋯(e)f(i+2)=(e)f(i)+(e)f′(i)(2∆x)(1!)+(e)f′′(i)(2∆x)2(2!)+(e)f′′′(i)(2∆x)3(3!)+(e)f′′′′(i)(2∆x)4(4!)-(e)f′′′′′(i)(2∆x)5(5!)+(e)f′′′′′′(i)(2∆x)6(6!)+⋯

By arranging the above Taylor series expansions in Taylor table; we get:-

Note: Only for the first five terms we assume our hypothesis. That’s why we can’t say about the last two terms.

Here we have five unknowns, so, we have to solve five equations and get values of coefficients (a,b,c,d,e).(a,b,c,d,e). We are going to form these equations by adding terms for the individual columns. The summation of coefficients of `f''(i) is equal to 1, andf(i),f′(i),f′'(i),f′''(i),f′'''(i)f(i),f′(i),f′′(i),f′′′(i),f′′′′(i) are equal to 0; because we want to calculate the second-order derivative, f′'(i).f′′(i).

Therefore, the five equations are:

a+b+c+d+e=0a+b+c+d+e=0 ……….. (I)

−2a−b+0+d+2e=0-2a-b+0+d+2e=0 ……….. (II)

2a+b2+0+d2+2e=12a+b2+0+d2+2e=1 ……….. (III)

−8a6−b6+0+d6+8e6=0-8a6-b6+0+d6+8e6=0 ……….. (IV)

16a24+b24+0+d24+16e24=016a24+b24+0+d24+16e24=0 ……….. (V)

To get the solution of the above equations, we have to solve the above equations in matrix form; AX=B.

After solving the above matrix, we get the values of all the coefficients as:

a=−0.083333a=-0.083333

b=1.333333b=1.333333

c=−2.500000c=-2.500000

d=1.333333d=1.333333

e=−0.083333e=-0.083333

Here, we can easily notice that a=e,a=e, and b=d.b=d.

Now, on dividing both side of my hypothesis equation (1) by (Δx2)(∆x2); we get:

∂2u∂x2=af(i−2)+bf(i−1)+cf(i)+df(i+1)+ef(i+2)(Δx2)∂2u∂x2=af(i-2)+bf(i-1)+cf(i)+df(i+1)+ef(i+2)(∆x2)

After putting the values of all the coefficients (a,b,c,d,e)(a,b,c,d,e) in the above equation, we will get the fourth-order central difference approximation for the second-order derivative.

∂2u∂x2=(−0.083333)f(i−2)+(1.333333)f(i−1)+(−2.500000)f(i)+(1.333333)f(i+1)+(−0.083333)f(i+2)(Δx2)∂2u∂x2=(-0.083333)f(i-2)+(1.333333)f(i-1)+(-2.500000)f(i)+(1.333333)f(i+1)+(-0.083333)f(i+2)(∆x2)

Now, from our Taylor table:

∂2u(∂x2)=(a+b+c++d+e)f(i)+(−2a−b+0+d+2e)f′(i)Δx+(2a+12b+0+12d+2e)f′'(i)Δx2+(−86a−16b+0+16d+86e)f′''(i)Δx3+(1624a+124b+0+124d+1624e)f′'''(i)Δx4+(−32120a−1120b+0+1120d+32120e)f′''''(i)Δx5+(64240a+1240b+0+1240d+64240e)f′'''''(i)Δx6∂2u(∂x2)=(a+b+c++d+e)f(i)+(-2a-b+0+d+2e)f′(i)∆x+(2a+12b+0+12d+2e)f′′(i)∆x2+(-86a-16b+0+16d+86e)f′′′(i)∆x3+(1624a+124b+0+124d+1624e)f′′′′(i)∆x4+(-32120a-1120b+0+1120d+32120e)f′′′′′(i)∆x5+(64240a+1240b+0+1240d+64240e)f′′′′′′(i)∆x6

To get second-order derivative the coefficient of f''(i)f′′(i) has to be 1. And as we want approximation for the second-order derivative, so, the term f(i),f′(i),f′''(i),f′'''(i)f(i),f′(i),f′′′(i),f′′′′(i) will have to ignore or set to ‘0’ in the above equation. On substituting the values of (I), (II), (IV), and (V) in the above equation; we’ll get:

∂2u(∂x2)=(2a+12b+0+12d+2e)f′'(i)Δx2+(−32120a−1120b+0+1120d+32120e)f′''''(i)Δx5+(64240a+1240b+0+1240d+64240e)f′'''''(i)Δx6∂2u(∂x2)=(2a+12b+0+12d+2e)f′′(i)∆x2+(-32120a-1120b+0+1120d+32120e)f′′′′′(i)∆x5+(64240a+1240b+0+1240d+64240e)f′′′′′′(i)∆x6

On dividing the above equation by (Δx2)(∆x2), we get:

∂2u(∂x2)=(2a+12b+0+12d+2e)f′'(i)+(64240a+1240b+0+1240d+64240e)f′'''''(i)Δx4∂2u(∂x2)=(2a+12b+0+12d+2e)f′′(i)+(64240a+1240b+0+1240d+64240e)f′′′′′′(i)∆x4

In the above equation, the term Δx4∆x4 denotes the truncation error. Here, we can see that the order of the truncation error; [O(Δx4∆x4)] is ‘4’. Since we know that the order of approximation is defined by the truncation error term. Therefore, we can say that our central difference scheme is 4th order accurate.

After putting the value of (a,b,c,d,e)(a,b,c,d,e) in the above equation, the final equation looks like this:

∂2u(∂x2)=(2(−0.083333)+1.3333332+1.3333332+2(0.083333))f′'(i)+(64240(−0.083333)+1.333333240+1.333333240+64240(0.083333))f′'''''(i)Δx4∂2u(∂x2)=(2(-0.083333)+1.3333332+1.3333332+2(0.083333))f′′(i)+(64240(-0.083333)+1.333333240+1.333333240+64240(0.083333))f′′′′′′(i)∆x4

2. Using Skewed Right-Sided Difference:

To derive 4th order skewed right-sided difference at point (i) of function. Since we’re using the skewed right-sided method, here we have to define five points on the right of (i). Let those points be (i+1), (i+2), (i+3), (i+4), and (i+5); with a spacing of Δx∆x each.

The numerical stencil will look like this:

According to the above stencil, our hypothesis equation will be:

∂2u(∂x)2=af(i)+bf(i+1)+cf(i+2)+df(i+3)+ef(i+4)+gf(i+5)∂2u(∂x)2=af(i)+bf(i+1)+cf(i+2)+df(i+3)+ef(i+4)+gf(i+5)

In order to find the values of coefficients (a,b,c,d,e,g),(a,b,c,d,e,g), we’re going to use the Taylor table method.

Writing Taylor series expansion for each term of equation (1) as:-

(a)f(i)=af(i)(a)f(i)=af(i)

(b)f(i+1)=(b)f(i)+(b)f′(i)(Δx)1!+(b)f′'(i)(Δx)22!+(b)f′''(i)(Δx)33!+(b)f′'''(i)(Δx)44!+(b)f′''''(i)(Δx)55!+(b)f′'''''(i)(Δx)66!+⋯(b)f(i+1)=(b)f(i)+(b)f′(i)(∆x)1!+(b)f′′(i)(∆x)22!+(b)f′′′(i)(∆x)33!+(b)f′′′′(i)(∆x)44!+(b)f′′′′′(i)(∆x)55!+(b)f′′′′′′(i)(∆x)66!+⋯

(c)f(i+2)=(c)f(i)+(c)f′(i)(2Δx)1!+(c)f′'(i)(2Δx)22!+(c)f′''(i)(2Δx)33!+(c)f′'''(i)(2Δx)44!+(c)f′''''(i)(2Δx)55!+(c)f′'''''(i)(2Δx)66!+⋯(c)f(i+2)=(c)f(i)+(c)f′(i)(2∆x)1!+(c)f′′(i)(2∆x)22!+(c)f′′′(i)(2∆x)33!+(c)f′′′′(i)(2∆x)44!+(c)f′′′′′(i)(2∆x)55!+(c)f′′′′′′(i)(2∆x)66!+⋯

(c)f(i+2)=(c)f(i)+(c)f′(i)(2Δx)1!+(c)f′'(i)(2Δx)22!+(c)f′''(i)(2Δx)33!+(c)f′'''(i)(2Δx)44!+(c)f′''''(i)(2Δx)55!+(c)f′'''''(i)(2Δx)66!+⋯(c)f(i+2)=(c)f(i)+(c)f′(i)(2∆x)1!+(c)f′′(i)(2∆x)22!+(c)f′′′(i)(2∆x)33!+(c)f′′′′(i)(2∆x)44!+(c)f′′′′′(i)(2∆x)55!+(c)f′′′′′′(i)(2∆x)66!+⋯

(d)f(i+3)=(d)f(i)+(d)f′(i)(3Δx)1!+(d)f′'(i)(3Δx)22!+(d)f′''(i)(3Δx)33!+(d)f′'''(i)(3Δx)44!+(d)f′''''(i)(3Δx)55!+(d)f′'''''(i)(3Δx)66!+⋯(d)f(i+3)=(d)f(i)+(d)f′(i)(3∆x)1!+(d)f′′(i)(3∆x)22!+(d)f′′′(i)(3∆x)33!+(d)f′′′′(i)(3∆x)44!+(d)f′′′′′(i)(3∆x)55!+(d)f′′′′′′(i)(3∆x)66!+⋯

(e)f(i+4)=(e)f(i)+(e)f′(i)(4Δx)1!+(e)f′'(i)(4Δx)22!+(e)f′''(i)(4Δx)33!+(e)f′'''(i)(4Δx)44!+(e)f′''''(i)(4Δx)55!+(e)f′'''''(i)(4Δx)66!+⋯(e)f(i+4)=(e)f(i)+(e)f′(i)(4∆x)1!+(e)f′′(i)(4∆x)22!+(e)f′′′(i)(4∆x)33!+(e)f′′′′(i)(4∆x)44!+(e)f′′′′′(i)(4∆x)55!+(e)f′′′′′′(i)(4∆x)66!+⋯

(g)f(i+5)=(g)f(i)+(g)f′(i)(5Δx)1!+(g)f′'(i)(5Δx)22!+(g)f′''(i)(5Δx)33!+(g)f′'''(i)(5Δx)44!+(g)f′''''(i)(5Δx)55!+(g)f′'''''(i)(5Δx)66!

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.