#### unsupported operand type(s) for ** or pow(): ‘ABCMeta’ and ‘divide’

I am a beginner trying to set topography for mesh using Gaussian function but got the error in title for line ydel =.

``````# pick depth above which to deform mesh
ydeform = -0.5

yCoordFn = uw.function.input()[1]
xCoordFn = uw.function.input()[0]

#Gaussian bell curve (topography)
ydel = 0.2 * uw.function.math.exp ** (-((xCoordFn - 2.)** 2.) / (2. * 0.2230386** 2.))

if deformedmesh:
with mesh.deform_mesh():
for i in range(len(mesh.data[:])):
y = mesh.data[i,1]
if y >= ydeform:
delY = ydel.evaluate((mesh.data[i,0],mesh.data[i,1])) #0.1 * (mesh.data[i,0] + 1.)/2.
dY = (y - ydeform)/(-ydeform) * delY

mesh.data[i,1] += dY
``````

I have tried to separate the equation to steps like this,

``````def StepA():
return 2. *( 0.2230386** 2.)
def StepB():
return (xCoordFn - 2.)** 2.
def StepC():
return StepB / StepA
def StepD():
return uw.function.math.exp ** -(StepC)

ydel = 0.2 * StepD
``````

and this,

``````StepA = 2. * ( 0.2230386** 2.)
StepA = float(StepA)

StepB = (xCoordFn - 2.) ** 2.
StepB = float(StepB)

StepC = StepB/StepA
StepC = float(StepC)

StepD = uw.function.math.exp ** -(StepC)
StepD = float(StepD)

ydel = 0.2 * StepD
``````

but they all give similar error for ** of pow() but with function or float, or float argument must be a string or a number.

I have to use the uw.function because of the geodynamic modelling library (underworld2) I am using.

Source: Python Questions