In mathematics, the error function (also called the Gauss error function) is a special function (non-elementary) of sigmoid shape that occurs in probability, statistics, and partial differential equations describing diffusion.
It’s the probability that a normal random variable with mean 0 and variance 0.5 take value between [-x, x]. It is denoted by erf(x) and calculated by:-
In cmath library of C++, error function has been already implemented. There are two such functions:-
- erf(x) : This inbuilt function calculate the error function for input value of x. Parameter x which can be int or float or double. It return a double which is erf(x).
- erfc(x) : This inbuilt function calculate the complementary of error function for input value of x. Parameter x which can be int or float or double. It return a double which is 1 – erf(x).
probability that normal r.v X takes value between -0.25 & 0.25 is 0.276326
This article is contributed by Pratik Chhajer. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- C++ Floating Point Manipulation (fmod(), remainder(), remquo() ... in cmath)
- How to find Segmentation Error in C & C++ ? (Using GDB)
- C++ Mathematical Functions
- Searching in a map using std::map functions in C++
- Macros vs Functions
- List in C++ | Set 2 (Some Useful Functions)
- Functions that cannot be overloaded in C++
- Pure Functions
- Inline Functions in C++
- Ceil and Floor functions in C++
- __builtin_inf() functions of GCC compiler
- How arrays are passed to functions in C/C++
- Const member functions in C++
- C Library math.h functions
- Can virtual functions be inlined?