Symbolic variables in loops
Hi, I got a list of symbolic variables defined like this: P = list(var('P_%d' % i) for i in range(2*n + 1))
But when I try to manipulate these Variables in a for-loop like: for k in range(2,n + 2,2): print(P_k)
I'll get an error "NameError: name 'P_k' is not defined" I'm guessing there is no k in P_k because its one entity 'P_k' :-D But I hope it's possible to fix this by using "%" like in the definition above. Anyone knows how to?
Thanks
Also, probably n = something earlier in your code...
yeah. n = anything natural >= 2