sum - Sympy summation with indexed variable -
i seek create sympy look sum indexed variable previous explain here however, can not lambdify of look , give array sum calculated. impossible?
perhaps this?
>>> s=sum(indexed('x',i),(i,1,3)) >>> f = lambda x: subs(s.doit(), [s.function.subs(s.variables[0], j) ... j in range(s.limits[0][1], s.limits[0][2] + 1)], x).doit() >>> f((30,10,2)) 42
sum sympy calculus
No comments:
Post a Comment