Functions#
General functions#
- SpinWaveToolkit.distBE(w, temp=300, mu=-6.626070145940079e-22)#
Returns Bose-Einstein distribution for given chemical potential and temperature.
- SpinWaveToolkit.wavenumber2wavelength(wavenumber)#
Convert wavelength to wavenumber. lambda = 2*pi/k
- Parameters:
- wavenumber
float
or array_like (rad/m) wavenumber of the wave.
- wavenumber
- Returns:
See also
- SpinWaveToolkit.wavelength2wavenumber(wavelength)#
Convert wavenumber to wavelength. k = 2*pi/lambda
- Parameters:
- wavelength
float
or array_like wavelength of the wave.
- wavelength
- Returns:
See also
- SpinWaveToolkit.wrapAngle(angle)#
Wrap angle in radians to range
[0, 2*np.pi)
.- Parameters:
- angle
float
or array_like (rad) angle to wrap.
- angle
- Returns:
- SpinWaveToolkit.roots(f, a, b, dx=0.001, eps=1e-09, args=())#
Find all roots of a continuous function
f(x, *args)
within a given interval [a, b].Detects all roots spaced at least by dx with a precision given by eps.
For optimal performance, normalize dx and eps to the scale of your input. In case it didn’t find all expected roots, try decreasing dx, but note that it can extend the calculation time significantly.
- Parameters:
- f
callable()
Function to evaluate with signature
f(x, *args)
.- a, b
float
(x units) left and right boundaries of the interval to search.
- dx
float
(x units) stepsize of evaluation points (coarse search).
- eps
float
,optional
(x units) tolerance of the to-be-found roots (fine search).
- args
list
,optional
List of arguments to be passed to f.
- f
- Returns:
See also
bisect
,rootsearch