A Julia package for discrete approximations of differential operators
Run the following code on the to install this package.
import Pkg; Pkg.add(url="https://github.com/ohno/FiniteDifferenceMatrices.jl.git")
Run the following code before each use.
using FiniteDifferenceMatrices
A central finite difference of the second-order derivative is
julia> fdcoefficient(n=2, m=2, d=:c)
Dict{Int64, Rational{Int64}} with 3 entries:
0 => -2//1
-1 => 1//1
1 => 1//1
A discrete approximation of the second-order differential operator is
julia> fdmatrix(5, n=2, m=2, d=:c, h=1//1)
5×5 SparseArrays.SparseMatrixCSC{Rational{Int64}, Int64} with 13 stored entries:
-2//1 1//1 ⋅ ⋅ ⋅
1//1 -2//1 1//1 ⋅ ⋅
⋅ 1//1 -2//1 1//1 ⋅
⋅ ⋅ 1//1 -2//1 1//1
⋅ ⋅ ⋅ 1//1 -2//1
Please see Tables, Examples and API reference for more information.
There are several tools for developers.
git clone https://github.com/ohno/FiniteDifferenceMatrices.jl.git
cd FiniteDifferenceMatrices.jl
julia
julia> include("dev/revice.jl")
julia> include("dev/test.jl")
julia> include("dev/docs.jl")