Faddeeva function: Difference between revisions

Content deleted Content added
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
 
(41 intermediate revisions by 23 users not shown)
Line 1:
The '''[[File:Faddeeva.svg|thumb|right|400px|Faddeeva function''' oron '''Kramp function''' is a scaledthe complex complementary [[error functionplane]],
 
The '''Faddeeva function''' or '''Kramp function''' is a scaled [[complex number|complex]] complementary [[error function]],
:<math>w(z):=e^{-z^2}\operatorname{erfc}(-iz) = \operatorname{erfcx}(-iz)
=e^{-z^2}\left(1+\frac{2i}{\sqrt{\pi}}\int_0^z e^{t^2}\text{d}t\right).</math>
It is related to the [[Fresnel integral]], to [[Dawson's integral]], and to the [[Voigt function]].
 
The function arises in various physical problems, intypically describingrelating to electromagnetic responseresponses in complicated media.
* problems involving small-amplitude waves propagating through [[Maxwell–Boltzmann distribution|Maxwellian]] [[Plasma (physics)|plasmas]], and in particular appears in the plasma's [[permittivity]] from which [[dispersion relation]]s are derived, hence it is sometimes referred to as the '''plasma dispersion function'''<ref name="errorfun"lehtinen>{{cite web|url=http://nlpc.stanford.edu/nleht/Science/reference/errorfun.pdf|title=Error functions|last=Lehtinen|first=Nikolai G.|date=April 23, 2010|website=Lehtinen webpage - Stanford University|archive-url=|archive-date=|access-date=October 8, 2019}}</ref>'''<ref name=Zaghloul11/> (although this name is sometimes used instead for the rescaled function <math>{{nowrap|1=''Z''(''z'') = ''i\''{{sqrt|{{\pi}}}} ''w''(''z'')</math>}} defined by ''Fried and Conte'', 1961<ref name="errorfun"lehtinen /><ref>[http://farside.ph.utexas.edu/ Richard Fitzpatrick], [http://farside.ph.utexas.edu/teaching/plasma/lectures/node87.html Plasma Dispersion Function], ''[http://farside.ph.utexas.edu/teaching/plasma/plasma.html Plasma Physics]'' lecture notes, University of Texas at Austin (2011/3/31).</ref>).
* the infrared [[permittivity]] functions of amorphous oxides have resonances (due to [[phonon]]s) that are sometimes too complicated to fit using simple harmonic oscillators. The Brendel–Borman[[Brendel–Bormann oscillator formmodel]] uses an infinite superposition of oscillators having slightly different frequencies, with a Gaussian distribution.<ref name="BrendelBormann1992">{{cite journal|last1=Brendel|first1=R.|last2=Bormann|first2=D.|title=An infrared dielectric function model for amorphous solids|journal=Journal of Applied Physics|volume=71|issue=1|year=1992|pagespage=1|issn=0021-8979|doi=10.1063/1.350737|bibcode=1992JAP....71....1B}}</ref> The integrated response can be written in terms of the Faddeeva function.
* the Faddeeva function is also used in the analysis of electromagnetic waves of the type used in AM radio.{{citation needed|date=July 2016}} Groundwaves are verticalyvertically polarised waves propagating over a lossy ground with finite resistivity and permittivity.
* the Faddeeva function also describes the changes of the [[neutron cross section]]s of materials as temperature is varied.<ref>{{cite web|url=https://docs.openmc.org/en/v0.12.0/methods/cross_sections.html?highlight=faddeeva#windowed-multipole-representation |title=OpenMC Windowed Multipole |date=2020-06-01 |accessdate=2020-12-20}}</ref>
 
== Properties ==
Line 22 ⟶ 25:
:<math>w(-z)=2e^{-z^2} - w(z)</math>
and
:<math>w(-z)=w\left(z^*\right)^*</math>
where * denotes complex conjugate.
 
=== Relation to the complementary error function ===
The Faddeeva function evaluated on imaginary arguments equals the scaled complementary error function (<math>\mathrm{erfcx}</math>):
:<math>w(iz)=\mathrm{erfcx}(z)=e^{z^2}\mathrm{erfc}(z)</math>,
where erfc is the [[complementary error function]]. For large real ''x'':
:<math>\mathrm{erfcx}(x)\approx \frac{1}{\sqrt{\pi} x}</math>
 
=== Derivative ===
In some applications, it is necessary to know not only the original values of the Faddeeva function, but also its derivative (e.g. in [[Non-linear least squares|Non-linear least squares regression]] in [[spectroscopy]]). Its derivative is given by:<ref>{{cite report
| first = Slava
| last = Avetisov
| year = 1995
| title = A Least-Squares Fitting Technique for Spectral Analysis of Direct and Frequency-Modulation Lineshapes
| url = https://lup.lub.lu.se/search/ws/files/5695063/2297010.pdf
| publisher = Department of Physics, Lund University
}}</ref><ref>{{cite web
|url = https://dlmf.nist.gov/7.10
|title = Faddeeva (or Faddeyeva) function - 7.10 Derivatives
|date = 2010
|website = Digital Library of Mathematical Functions
|publisher = National Institute of Standards and Technology
|access-date = June 23, 2022
}}</ref>
:<math>\frac{dw\left(z\right)}{dz} = \frac{2i}{\sqrt{\pi}} - 2\cdot z\cdot w\left(z\right)</math>
This expression can also be broken down further in terms of changes in the real and imaginary part of the Faddeeva function <math>\Re\left(w\left(z\right)\right) = \Re_{w}</math> and <math>\Im\left(w\left(z\right)\right) = \Im_{w}</math>. Basically, this requires knowledge about the real and imaginary part of the product <math>z\cdot w\left(z\right)</math>. Making use of the above definition <math>z = x + iy</math>, the derivative can therefore be split into [[partial derivative]]s with respect to <math>x</math> and <math>y</math> as follows:
:<math>\frac{d\Re_{w}}{dx} = 2\cdot\left(y\cdot\Im_{w} - x\cdot\Re_{w}\right) = \frac{d\Im_{w}}{dy}</math>{{spaces|6|type}}and{{spaces|6|type}}<math>\frac{d\Re_{w}}{dy} = -2\cdot\left(\frac{1}{\sqrt{\pi}} - x\cdot\Im_{w} - y\cdot\Re_{w}\right) = -\frac{d\Im_{w}}{dx}</math>
:<math>\frac{d\Im_{w}}{dx} = 2\cdot\left(\frac{1}{\sqrt{\pi}} - x\cdot\Im_{w} - y\cdot\Re_{w}\right) = -\frac{d\Re_{w}}{dy}</math>{{spaces|6|type}}and{{spaces|6|type}}<math>\frac{d\Im_{w}}{dy} = 2\cdot\left(y\cdot\Im_{w} - x\cdot\Re_{w}\right) = \frac{d\Re_{w}}{dx}</math>
A practical example for the use of these partial derivatives can be found [[Voigt profile#Derivative_profile|here]].
 
== Integral representation ==
 
The Faddeeva function occurs as
:<math>w(z)=\frac{i}{\pi}\int_{-\infty}^{\infty} \frac{e^{- t^2}}{z - t} dt\,\mathrm{d}t = \frac{2iz}{\pi} \int_{0}^{\infty} \frac{e^{- t^2}}{z^2 - t^2} dt\,\mathrm{d}t, \qquad \operatorname{Im}z > 0 </math>
meaning that it is a convolution of a Gaussian with a simple pole.
 
==History==
 
The function was tabulated by [[Vera Faddeeva]] and N. N. Terent'evTerentyev in 1954.<ref>[[Vera Faddeeva|V. N. Faddeeva]] and N. N. Terent'ev: Tables of values of the function <math>w(z)=\exp(-z^2)(1+2i/\sqrt{\pi}\textstyle\int_0^z\exp(t^2)\text{d}t)</math> for complex argument. ''Gosud. Izdat. Teh.-Teor. Lit.'', Moscow, 1954; English transl., Pergamon Press, New York, 1961. Unverified citation, copied from ''Poppe and Wijers'' (1990).</ref> It appears as nameless function ''w(z)'' in ''[[Abramowitz and Stegun]]'' (1964), formula 7.1.3. The name '''Faddeeva function''' was apparently introduced by ''G. P. M. Poppe and C. M. J. Wijers'' in 1990;<ref>Earliest search result in Google Scholar as of Oct 2012.</ref>{{better source needed|date=October 2019}} previously, it was known as Kramp's function (probably after [[Christian Kramp]]).<ref>For instance in Al'pert, Space Science Reviews 6, 781 (1967), formula (3.13), with reference to Faddeeva and Terent'ev.</ref>
 
Early implementations used methods by [[Walter Gautschi]] (1969/701969–70; [[ACM Transactions on Mathematical Software|ACM Algorithm]] 363)<ref>See references 3 and 4 in ''Poppe and Wijers'' (1990).</ref> or by J. Humlicek (1982).<ref>J. Humlicek, J. Quant. Spectrosc. Radiat. Transfer 27, 437-444 (1982).</ref> A more efficient algorithm was proposed by ''Poppe and Wijers'' (1990; ACM Algorithm 680).<ref>G. P. M. Poppe and C. M. J. Wijers, [[ACM Transactions on Mathematical Software]] 16, 38-46 (1990).</ref> J.A.C. Weideman (1994) proposed a particularly short algorithm that takes no more than eight lines of [[MatlabMATLAB]] code.<ref>J. A. C. Weideman, SIAM J. Numer. Anal. 31, 1497-1518 (1994).</ref> Zaghloul and Ali pointed out deficiencies of previous algorithms and proposed a new one (2011; ACM Algorithm 916).<ref name=Zaghloul11>M. R. Zaghloul and A. N. Ali, ACM Transactions on Mathematical Software 38(2)15 (2011)</ref> Another algorithm has been proposed by M. Abrarov and B.M. Quine (2011/2012).<ref>S. M. Abrarov and B. M. Quine, Appl. Math. Comp. 218, 1894-1902 (2011) and arXiv:1205.1768v1 (2012).</ref>
 
==Implementations==
 
Two software implementations, which are free for non-commercial use only,<ref>{{Citecite web | url=http://www.acm.org/publications/policies/softwarecrnotice | title=Software Copyright Notice}}; hence they are not ''free'' in the sense of [[free and open-source software]]</ref> were published in [[ACM Transactions on Mathematical Software]] (TOMS) as Algorithm 680 (in [[Fortran]],<ref>http://www.cs.kent.ac.uk/people/staff/trh/CALGO/680.gz {{Dead link|date=February 2022}}</ref> later translated into [[C (programming language)|C]])<ref>{{cite web |url=http://spec.jpl.nasa.gov/ftp/pub/calpgm/collisions/ZWOFZ.C |title=Collision formulas|website=NASA|access-date=10 April 2023}}</ref>) and Algorithm 916 by Zaghloul and Ali (in [[MATLAB]]).<ref>Mofreh R. Zaghloul and Ahmed N. Ali, "[https://dx.doi.org/10.1145/2049673.2049679 Algorithm 916: Computing the Faddeyeva and Voigt Functions]," ''ACM Trans. Math. Soft.'' '''38''' (2), 15 (2011). Preprint available at [https://arxiv.org/abs/1106.0151 arXiv:1106.0151].</ref>
 
A [[free and open source]] C or C++ implementation derived from a combination of Algorithm 680 and Algorithm 916 (using different algorithms for different ''z'') is also available under the [[MIT License]],<ref name=Faddeeva_w>[http://ab-initio.mit.edu/Faddeeva Faddeeva Package], free/open-source C++ implementation, accessed 13 October 2012.</ref> , and is maintained as a library package ''libcerf''.<ref>{{Citecite web | url=https://jugit.fz-juelich.de:/mlz/libcerf | title=Libcerf &#91;MLZ Scientific Computing Group&#93;}}</ref>
This implementation is also available as a [[Plug-in (computing)|plug-in]] for Matlab,<ref name=Faddeeva_w/> [[GNU Octave]],<ref name=Faddeeva_w/> and in [[Python (programming language)|Python]] via [[Scipy]] as <code>scipy.special.wofz</code> (which was originally the TOMS 680 code, but was replaced due to copyright concerns<ref>{{Citecite web | url=https://github.com/scipy/scipy/issues/2260 | title=SciPy's complex erf code is not free/open-source? (Trac #1741) · Issue #2260 · scipy/scipy| website=[[GitHub]]}}</ref>).
 
For fast but still accurate calculation of plasma dispersion function <math>Z(z)</math>, the J-pole Pade approximation is found to be useful,<ref>{{Cite journal |last=Xie |first=Hua-sheng |date=November 2019 |title=BO: A unified tool for plasma waves and instabilities analysis |url=http://dx.doi.org/10.1016/j.cpc.2019.06.014 |journal=Computer Physics Communications |volume=244 |pages=343–371 |doi=10.1016/j.cpc.2019.06.014 |issn=0010-4655|arxiv=1901.06902 }}</ref> i.e.,
:<math>Z(z)=\sum_{j=1}^{J}\frac{b_j}{z-c_j}.</math>
For J=8, one can use
b1= -0.017340112270401 - 0.046306439626294i;
b2= -0.739917811220052 + 0.839518284620274i;
b3= 5.840632105105495 + 0.953602751322040i;
b4= -5.583374181615043 -11.208550459628098i;
c1= 2.237687725134293 - 1.625941024120362i;
c2= 1.465234091939142 - 1.789620299603315i;
c3= 0.839253966367922 - 1.891995211531426i;
c4= 0.273936218055381 - 1.941787037576095i;
b(5:8)=(b(1:4))*;
c(5:8)=-(c(1:4))*,
 
where * denotes complex conjugate. The above approximation is valid for the upper plane. For <math>z</math> weakly close to the real axis, i.e., <math>Im(z)</math> not far from the real axis of the lower plane, the above approximation is also valid. For accurate calculation of
<math>Im(z)<0</math>, one can use
:<math>Z(z)=[Z(z^*)]^*+2i\sqrt{\pi}\exp[-z^2].</math>
 
A coding of the above J-pole approach and comparison with an accurate plasma dispersion function can be found.<ref>{{Citation |last=XIE |first=Hua-sheng |title=hsxie/gpdf |date=2024-04-14 |url=https://github.com/hsxie/gpdf |access-date=2024-04-15}}</ref> Comphensive coefficients to rapid computation of the plasma dispersion function with rational and multi-pole approximation are also available.<ref>{{Cite journal |last=Xie |first=Huasheng |date=2024-07-01 |title=Rapid computation of the plasma dispersion function: Rational and multi-pole approximation, and improved accuracy |url=https://pubs.aip.org/adv/article/14/7/075007/3300717/Rapid-computation-of-the-plasma-dispersion |journal=AIP Advances |language=en |volume=14 |issue=7 |doi=10.1063/5.0216433 |issn=2158-3226|arxiv=2404.18719 }}</ref>
 
==See also==
 
* {{annotated link|List of mathematical functions}}
A [[free and open source]] C or C++ implementation derived from a combination of Algorithm 680 and Algorithm 916 (using different algorithms for different ''z'') is also available under the [[MIT License]],<ref name=Faddeeva_w>[http://ab-initio.mit.edu/Faddeeva Faddeeva Package], free/open-source C++ implementation, accessed 13 October 2012.</ref> , and is maintained as a library package ''libcerf''.<ref>{{Cite web | url=https://jugit.fz-juelich.de:mlz/libcerf | title=Libcerf &#91;MLZ Scientific Computing Group&#93;}}</ref>
This implementation is also available as a [[Plug-in (computing)|plug-in]] for Matlab,<ref name=Faddeeva_w/> [[GNU Octave]],<ref name=Faddeeva_w/> and in [[Python (programming language)|Python]] via [[Scipy]] as <code>scipy.special.wofz</code> (which was originally the TOMS 680 code, but was replaced due to copyright concerns<ref>{{Cite web | url=https://github.com/scipy/scipy/issues/2260 | title=SciPy's complex erf code is not free/open-source? (Trac #1741) · Issue #2260 · scipy/scipy}}</ref>).
 
==References==
{{Reflistreflist}}
 
[[Category:Gaussian function]]