Error Function Erfz
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or error function r posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Error Message In R
Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes faddeeva function a minute: Sign up R Error Function Erf(z) up vote 2 down vote favorite 1 This could be a quick one. I have not been able to find a function for the mathematical "error function" or the "inverse error function"
Complex Error Function
in R. I have not seen a package either. I am aware I can script this but I thought someone MUST have made a package for its various approximations by now. Could be poor googling due to generic terms "error function". Thanks in advance.. r function statistics share|improve this question asked Mar 16 '15 at 0:25 deposition 3015 The pracma package has the erf function. –eipi10 Mar 16 '15 at 0:29 Re: search terms -- try "Gaussian pracma r error function", I think that brings up the right thing. –Robert Dodier Mar 16 '15 at 16:55 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote These are very closely related to pnorm() and qnorm(): see the last 4 lines of the example code in ?pnorm: ## if you want the so-called 'error function' erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1 ## (see Abramowitz and Stegun 29.2.29) ## and the so-called 'complementary error function' erfc <- function(x) 2 * pnorm(x * sqrt(2), lower = FALSE) ## and the inverses erfinv <- function (x) qnorm((1 + x)/2)/sqrt(2) erfcinv <- function (x) qnorm(x/2, lower = FALSE)/sqrt(2) If you want to use complex-valued arguments, you need erfz from the pracma package (as commented above by @eipi10). Otherwise, it's not clear whether there's an advantage to using the versions in pracma (the implementations of pnorm() and qnorm() have been very thoroughly tested over a wide range of parameter values ...) As far as searching goes, library("sos") findFn("erf") seems to work pretty well ... share|improve this answer edited Mar 16 '15 at 0:52 answered Mar 16 '15 at 0:46 Ben Bolker 97.1k6134226 if this answers your question you're encouraged to click the check mark to accept it ... –Ben Bolker Sep 13 at 10:13 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Fac
The error or Phi function is a variant of the cumulative normal (or Gaussian) distribution. Usage 1 2 3 4 5
R Pnorm
6 7 8erf(x) erfinv(y) erfc(x) erfcinv(y) erfcx(x) erfz(z) erfi(z) Arguments
Inverse Error Function
x, y vector of real numbers. z real or complex number; must be a scalar. Details complementary error function erf and erfinv are the error and inverse error functions. erfc and erfcinv are the complementary error function and its inverse. erfcx is the scaled http://stackoverflow.com/questions/29067916/r-error-function-erfz complementary error function. erfz is the complex, erfi the imaginary error function. Value Real or complex number(s), the value(s) of the function. Note For the complex error function we used Fortran code from the book S. Zhang & J. Jin “Computation of Special Functions” (Wiley, 1996). Author(s) First version by Hans W https://rdrr.io/rforge/pracma/man/erfz.html Borchers; vectorized version of erfz by Michael Lachmann. See Also pnorm Examples 1 2 3 4 5 6 7 8 9 10 11 12 x <- 1.0 erf(x); 2*pnorm(sqrt(2)*x) - 1 # [1] 0.842700792949715 # [1] 0.842700792949715 erfc(x); 1 - erf(x); 2*pnorm(-sqrt(2)*x) # [1] 0.157299207050285 # [1] 0.157299207050285 # [1] 0.157299207050285 erfz(x) # [1] 0.842700792949715 erfi(x) # [1] 1.650425758797543 Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello. abm3: Adams-Bashford-Moulton accumarray: Accumulate Vector Elements agmean: Arithmetic-geometric Mean aitken: Aitken' Method akima: Univariate Akima Interpolation andor: Logical AND, OR (Matlab Style) andrews: Andrews' Curves angle: Basic Complex Functions arclength: Arc Length of a Curve barylag: Barycentric Lagrange Interpolation barylag2d: 2-D Barycentric Lagrange Interpolation beep: Utility functions (Matlab style) bernoulli: Bernoulli Numbers and Polynomials bisect: Rootfinding Through Bisection bits: Binary Representation blanks: String of Blank Carakters blkdiag: Block Diagonal Matrix brentdekker: Brent-Dekker Root Finding
that occurs in probability, statistics, and partial differential equations describing diffusion. It is defined as:[1][2] erf ( x ) = 1 π ∫ − x x e − t 2 d t = 2 π ∫ 0 x e − t 2 d t https://en.wikipedia.org/wiki/Error_function . {\displaystyle {\begin − 6\operatorname − 5 (x)&={\frac − 4{\sqrt {\pi }}}\int _{-x}^ − 3e^{-t^ − https://github.com/jmakitalo/pgf/tree/master/ErrorFunction 2}\,\mathrm − 1 t\\&={\frac − 0{\sqrt {\pi }}}\int _ 9^ 8e^{-t^ 7}\,\mathrm 6 t.\end 5}} The complementary error function, denoted erfc, is defined as erfc ( x ) = 1 − erf ( x ) = 2 π ∫ x ∞ e − t 2 d t = e − x 2 erfcx ( x error function ) , {\displaystyle {\begin 2\operatorname 1 (x)&=1-\operatorname 0 (x)\\&={\frac Φ 9{\sqrt {\pi }}}\int _ Φ 8^{\infty }e^{-t^ Φ 7}\,\mathrm Φ 6 t\\&=e^{-x^ Φ 5}\operatorname Φ 4 (x),\end Φ 3}} which also defines erfcx, the scaled complementary error function[3] (which can be used instead of erfc to avoid arithmetic underflow[3][4]). Another form of erfc ( x ) {\displaystyle \operatorname 2 (x)} for non-negative x {\displaystyle x} is known as Craig's formula:[5] erfc ( x | error function erfz x ≥ 0 ) = 2 π ∫ 0 π / 2 exp ( − x 2 sin 2 θ ) d θ . {\displaystyle \operatorname 0 (x|x\geq 0)={\frac Φ 9{\pi }}\int _ Φ 8^{\pi /2}\exp \left(-{\frac Φ 7}{\sin ^ Φ 6\theta }}\right)d\theta \,.} The imaginary error function, denoted erfi, is defined as erfi ( x ) = − i erf ( i x ) = 2 π ∫ 0 x e t 2 d t = 2 π e x 2 D ( x ) , {\displaystyle {\begin Φ 0\operatorname − 9 (x)&=-i\operatorname − 8 (ix)\\&={\frac − 7{\sqrt {\pi }}}\int _ − 6^ − 5e^ − 4}\,\mathrm − 3 t\\&={\frac − 2{\sqrt {\pi }}}e^ − 1}D(x),\end − 0}} where D(x) is the Dawson function (which can be used instead of erfi to avoid arithmetic overflow[3]). Despite the name "imaginary error function", erfi ( x ) {\displaystyle \operatorname 8 (x)} is real when x is real. When the error function is evaluated for arbitrary complex arguments z, the resulting complex error function is usually discussed in scaled form as the Faddeeva function: w ( z ) = e − z 2 erfc ( − i z ) = erfcx ( − i z ) . {\displaystyle w(z)=e^{-z^ 6}\operatorname 5 (-iz)=\operatorname 4 (-iz).} Contents 1 The name "error function" 2 Properties 2.1 Taylor series 2.
Sign in Pricing Blog Support Search GitHub This repository Watch 2 Star 0 Fork 1 jmakitalo/pgf Code Issues 0 Pull requests 0 Projects 0 Pulse Graphs Branch: master Switch branches/tags Branches Tags master Nothing to show Nothing to show Create new file Find file History pgf/ErrorFunction/ Fetching latest commit… Cannot retrieve the latest commit at this time. Permalink .. Failed to load latest commit information. @double Readme.txt Readme.txt MATLAB toolbox ________________________________________________________ Error function of complex numbers ________________________________________________________ ** Contents 1. Overview 2. Requirements 3. Installation 4. Copyright 5. Warranty 6. History 7. Download 8. Trademarks ** Publisher Marcel Leutenegger marcel.leutenegger@a3.epfl.ch EPFL STI SMT LOB BM 4.245 Phone: +41 21 693 78 21 Station 17 CH-1015 Lausanne 1. Overview This package provides improved implementations of the error function for MATLAB. It ships a MEX-file for calculating the error function of real- valued numbers 5-6x faster than with the default MATLAB implementation. A second MEX-file and/or a companion M-file enhances the calculation of the error function for complex numbers. See "erfz.pdf" for implementa- tion details. 2. Requirements • An Intel Pentium II compatible computer or newer. • MATLAB 6.0 or newer running. 3. Installation Unpack the archive in a folder that is part of the MATLAB path. The error functions should reside in a '@double' folder to avoid potential data type conflicts. 4. Copyright This software is published as freeware. The author reserves the right to modify any of the contained files. You are allowed to distribute the functions as long as you deliver for free the entire package. Path Files / Readme.txt @double/ erf.dll Replaces MATLAB's error function erfz.dll Error function of complex numbers erfz.m Help and companion function erfz.pdf Implementation details 5. Warranty Any warranty is strictly refused and you cannot anticipate any financial or technical support in case of malfunction or damage. Feedback and comments are welcome. I will try to track reported problems and fix bugs. 6. History • January 14, 2008 Initial relase. 7. Download Optimized MATLAB functions are available online at (subject to change): http://ioalinux1.epfl.ch/~mleutene/MATLABToolbox/ Summaries are also published at MATLAB central: http://www.mathworks.com/matlabcentral/ 8. Trademarks MATLAB is a registered trademark of The MathWorks, Inc. Pentium is a registered