Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator

# What is math.erf() in Python?

Eman Kashif

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Python is a high-level programming language that provides functionalities for a number of operations. The math module comes with mathematical methods and constraints, which make for straightforward calculations. math.erf() is used to print error functions for numbers. Error functions are used widely in statistical computations, machine learning, and a number of theoretical applications. It is defined as the integral of the normal distribution. There are a number of rules attached to this function:

1. math.erf (-∞) = -1
2. math.erf (+∞) = 1
3. math.erf (-x) = -math.erf(x)
4. math.erf (x*) = [math.erf (x)]*

### Syntax

math.erf(x)

### Parameters

• x: The specified number of which to find the error function. Any positive or negative number is accepted. This parameter is required.

### Return value

This method returns the error function of the specified number in the form of a float value between -1 and +1.

### Code

#import library
import math

#display error functions for different values
print('Error function of 34 ==>',math.erf(34))
print('Error function of -10 ==>',math.erf(-10))
print('Error function of -0.98 ==>',math.erf(-0.98))
print('Error function of 5 ==>',math.erf(5))
print('Error function of 28.67 ==>',math.erf(28.67))
print('Error function of 100 ==>',math.erf(100))
print('Error function of -100 ==>',math.erf(-100))

RELATED TAGS

python
communitycreator

CONTRIBUTOR

Eman Kashif

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Learn in-demand tech skills in half the time 