| 1 | initial version |
I'm not sure to understand your question, but...
k is a symbolic variable. You can't "set" it stricto sensu (setting the python variable kwould destroy your only reference to the symbolic variable k) but you can substitute it with another value ; for example, you could write your "print" line as print(n, klstar.subs(k1==<SomeValue>).n()) (if you want numeric values).
Collecting the successive values of n and k1(n) is left as an exercise for the reader (there are a large number of ways to do this, not all of them worth exposition...).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.