"How would this equation be calculated in a language such as Python or Haskell?" . . . . .