import math


def eps_indef_int_x_sqr_exp_epsx(eps, x, add_to_exp=0.0):
  """Integral of x^2 * exp(eps * x)dx times eps * exp(add_to_exp)."""
  return (1.0 / eps**2) * math.exp(eps * x + add_to_exp) * (
      (eps * x)**2 - 2 * eps * x + 2)