On 2013-7-17 02:07, Laurent Decreusefond wrote:
For any tuple of integer (a_1,a_2, ..., a_k), [...]
I want to form the function
z -> sum_{i=1}^k |f(a_i, z)|^2
Won't this work?
def ff(atuple,z):
return sum([ abs(f(n,z))**2 for n in atuple ])
--
*\\* Anton Sherwood *
I don't think you need to make an explicit class here. You can build a
function from within another function, and return that:
sage: def f(n, z):
: return z**n
:
sage: def maker(tup):
: def g(z):
: return sum(abs(f(a_i,z))**2 for a_i in tup)
: return g
Hi everyone,
say I have a function of both an integer n and a complex z
def f(n,z):
return z**n
For any tuple of integer (a_1,a_2, ..., a_k), (actually, k and a_i are
random), I want to form the function
z -> sum_{i=1}^k |f(a_i, z)|^2
The result must still be a function. I guess it is s