I am using math.erf to find the error function of each element in an array.
# Import the erf function from the math library
from math import erf
# Import the numpy library to represent the input data
import numpy as np
# Create a dummy np.array
dummy_array = np.arange(20)
# Apply the erf function to the array to calculate the error function of each element
erf_array = erf(dummy_array)
I am getting an error as I cannot apply this whole function to an array. Is there a way to apply the error function to the whole array (vectorised approach) without looping through each element and applying it? (The loop will take a lot of time as the tables will be large)