from gekko import GEKKO m = GEKKO() x = m.Param(-2) # use abs2 to define a new variable y = m.abs2(x) # use abs2 in an equation z = m.Var() m.Equation(z==m.abs2(x)+1) m.solve() # solve print('x: ' + str(x.value)) print('y: ' + str(y.value)) print('z: ' + str(z.value))