Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Fast numerical approximation to the PDF of the Voigt distribution with around 1.2% of maximum deviation
ResourceFunction["NPseudoVoigt"][x,b,σ] calculates the approximation at postions x of a Voigt distribution with CauchyDistribution parameter b and NormalDistribution parameter σ. |
NPseudoVoigt always returns numerical results, even for exact inputs:
In[1]:= |
Out[1]= |
NPseudoVoigt compared to the analytic solution:
In[2]:= |
Out[2]= |
NPseudoVoigt automatically threads over lists:
In[3]:= |
Out[3]= |
NPseudoVoigt is approximately normed to 1 for b and σ greater than 0:
In[4]:= |
Out[4]= |
NPseudoVoigt's norm has four additional terms that cancel out for non-extreme values of b and σ:
In[5]:= |
Out[5]= |
NPseudoVoigt's deviation to the analytic solution in the maximum is usually less than ±1% for every parameter combination b and σ:
In[6]:= |
Out[6]= |
NPseudoVoigt's relative deviation increases if b and σ approach one another:
In[7]:= |
Out[7]= |
NPseudoVoigt is also stable against σ being 0:
In[8]:= |
Out[8]= |
NPseudoVoigt can be compiled to obtain faster execution times:
In[9]:= |
Out[3]= |
In[10]:= |
Out[10]= |
In[11]:= |
Out[11]= |
Negative b parameters can produce imaginary values:
In[12]:= |
Out[12]= |
Negative σ parameters do not yield symmetric values:
In[13]:= |
Out[13]= |
NPseudoVoigt can be used to approximate an atomic absorption spectrum efficiently:
In[14]:= |
Out[15]= |
Out[16]= |
NPseudoVoigt can be used to show that σ is negligible or even 0, whereas the VoigtDistribution could throw errors:
In[17]:= |
Out[19]= |
This work is licensed under a Creative Commons Attribution 4.0 International License