Essentially I have 1D arrays of eigenvalues as shown in the above plot and I want to find the 2nd derivative of each energy band with respect to ϵ.
My current method uses Dierckx.jl.
In my code, the eigenvalues are stored in a 3D array with the structure
[Energy band, value of ϵ, value of B], at the moment that’s a [5, 520, 520]. Hence the loops in the code below:
function QuantumCapacitance(E, ϵ)
Q_C = Array{Float64, 3}(undef, 5, size(E,2), size(E,3)) # Define array
for i = 1:size(E,2) # Magetic field loop
for j = 1:5 # Eigenvalue Loop
itp = Spline1D(ϵ, E[j,:,i], k=2) # Value for 2nd derivative
for k = 1:size(E,2) # detuning, ϵ, loop
Q_C[j, k, i] = derivative(itp,ϵ[k],nu=2)
end
end
end
return Q_C
This method however takes up a lot of time in my code. Is there a more efficient way to do this, are there any finite difference method packages that would work better here, would Interpolations.jl be quicker.
My reason for not using that package was earlier in my code I had to perform a cubic spline and Dierckx was much more accurate.
Thank you