ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 02 Jun 2012 15:26:12 +0200creating a group of similar functions with similar nameshttps://ask.sagemath.org/question/9027/creating-a-group-of-similar-functions-with-similar-names/ namelist = ['f'+str(i) for i in range(10)]; namelist
for i in range(len(namelist)):
namelist[i] = lambda x: 1/x^i
1 - create a list of function names (f0, f1, f2, ...)
2 - for each item in namelist
3 - take that that item and make it a function that raises *x* to a negative power equal to the position of that item (f0(x) = 1/x^0, f1(x) = 1/x^1, ...)
Is this possible?
EDIT:
Made some progress by changing the type of namelist[i] to Expression by var(i)...daniel.e2718Sat, 02 Jun 2012 15:26:12 +0200https://ask.sagemath.org/question/9027/