From c1b477a1b2b796617c4e345a7296a8d429d7a067 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Sun, 26 Feb 2023 18:36:05 -0500 Subject: Update to v0.4 feature: compute the 2-point correlation function in easyeq. feature: compute the Fourier transform of the 2-point correlation function in anyeq and easyeq. feature: compute the local maximum of the 2-point correlation function and its Fourier transform. feature: compute the compressibility for anyeq. feature: allow for linear spacing of rho's. feature: print the scattering length. change: ux and uk now return real numbers. fix: error in the computation of the momentum distribution: wrong definition of delta functions. fix: various minor bugs. optimization: assign explicit types to variables. --- src/tools.jl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/tools.jl') diff --git a/src/tools.jl b/src/tools.jl index 0d3dc7f..5d1678d 100644 --- a/src/tools.jl +++ b/src/tools.jl @@ -1,4 +1,4 @@ -## Copyright 2021 Ian Jauslin +## Copyright 2021-2023 Ian Jauslin ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. @@ -13,7 +13,9 @@ ## limitations under the License. # \Phi(x)=2*(1-sqrt(1-x))/x -@everywhere function Phi(x) +@everywhere function Phi( + x::Float64 +) if abs(x)>1e-5 return 2*(1-sqrt(abs(1-x)))/x else @@ -21,7 +23,9 @@ end end # \partial\Phi -@everywhere function dPhi(x) +@everywhere function dPhi( + x::Float64 +) #if abs(x-1)<1e-5 # @printf(stderr,"warning: dPhi is singular at 1, and evaluating it at (% .8e+i% .8e)\n",real(x),imag(x)) #end @@ -33,17 +37,25 @@ end end # apply Phi to every element of a vector -@everywhere function dotPhi(v) +@everywhere function dotPhi( + v::Array{Float64,1} +) out=zeros(Float64,length(v)) for i in 1:length(v) out[i]=Phi(v[i]) end return out end -@everywhere function dotdPhi(v) +@everywhere function dotdPhi( + v::Array{Float64,1} +) out=zeros(Float64,length(v)) for i in 1:length(v) out[i]=dPhi(v[i]) end return out end + +@everywhere function sinc(x::Float64) + return (x == 0 ? 1 : sin(x)/x) +end -- cgit v1.2.3-70-g09d2