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 k
would 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...).