4th order Taylor series expansion:
ψ(x + ∆x) = ψ(x) + ∆x*∂ψ(x)/∂x + [(∆x)2/2]*∂2ψ(x)/∂x2 + [(∆x)3/3!]*∂3ψ(x)/∂x3 + [(∆x)4/4!]*∂4ψ(x)/∂x4 + ... .
ψ(x - ∆x) = ψ(x) - ∆x*∂ψ(x)/∂x + [(∆x)2/2]*∂2ψ(x)/∂x2 + [(∆x)3/3!]*∂3ψ(x)/∂x3 + [(∆x)4/4!]*∂4ψ(x)/∂x4 + ... .
Combining the two equations above yields
[ψ(x + ∆x) + ψ(x - ∆x) - 2ψ(x)]/(∆x)2
= ∂2ψ(x)/∂x2 + [(∆x)4/12]*∂4ψ(x)/∂x4  + O((∆x)4 ).  (equation 1)
Here O((∆x)4) denotes terms of higher than fourth order in ∆x.

From the Schroedinger equation,
2ψ(x)/∂x2 - k(x)2ψ(x) = 0,
we obtain
4ψ(x)/∂x4 = ∂2/∂x2(k2(x)ψ(x))
= [k2(x + ∆x)ψ(x + ∆x)  +  k2(x - ∆x)ψ(x - ∆x)  - 2k(x)2ψ(x)]/(∆x)2,
or
(∆x)24ψ(x)/∂x4 = k2(x + ∆x)ψ(x + ∆x)  +  k2(x - ∆x)ψ(x - ∆x)  - 2k(x)2ψ(x).
 

Inserting this expression into equation (1) and neglecting terms of higher than fourth order in ∆x we obtain
.
or, for solving on a grid,

.