from sympy.abc import i, k, m, n, x import sympy def prob_2a(): # f = sympy.Function('f') def f(x, theta): return (1.0 / theta) * sympy.exp(- x / theta) log = sympy.Sum(f, (k, 1, n)) print(log) prob_2a()