# How to implement a Gaussian function in field calculator?

Are there any build-in functions like Gaussian or Epanechnikov functions in field calculator? Or I have to write that by myself?

• What are you trying to achieve with it and what would you be running it on? – Michael Stimson Jun 27 '14 at 4:24
• These functions seem to be present elsewhere in ArcGIS for Desktop i.e. as Kernel Functions in the Geostatistical Analyst extension – PolyGeo Jun 27 '14 at 4:30
• Which makes me think that the functions are there cleverly disguised by a different name. – Michael Stimson Jun 27 '14 at 4:32
• Thank you. Ya I know that, but I just want to do it within the attribute table. – PacmanKX Jun 27 '14 at 4:33
• When you've got that working properly consider answering your own question. Other users may encounter the same problem and could benefit from it. – Michael Stimson Jun 27 '14 at 5:02

First, you should note that field calculator applies only row by row (except if you use a static variable).

So you will need to precompute the mean and the standard deviation of your Gaussian distribution. Then run the equation in Python

``````def Gaussian(field, mean, std):
return math.exp(-(field-mean)**2/(2*std**2))/(math.sqrt(math.pi()*2)*std)
``````

Gaussian(!field!, mean, std)

for Epanechnikov,

``````def Epan(field, size):
if math.fabs(field) >= size:
return 0
else:
return 3*(1-(field/size)**2)/4
``````

Epan(!field!, size)