diff options
author | Ian Jauslin <ian.jauslin@rutgers.edu> | 2023-02-26 18:36:05 -0500 |
---|---|---|
committer | Ian Jauslin <ian.jauslin@rutgers.edu> | 2023-02-26 18:36:05 -0500 |
commit | c1b477a1b2b796617c4e345a7296a8d429d7a067 (patch) | |
tree | 8a8a2fc0fb6e7da5f4b0b271382740f858ee4372 /src/tools.jl | |
parent | e72af82c3ed16b81cdb5043c58abbdbb3cf02102 (diff) |
Update to v0.4v0.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.
Diffstat (limited to 'src/tools.jl')
-rw-r--r-- | src/tools.jl | 22 |
1 files changed, 17 insertions, 5 deletions
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 |