Is there a way to define local symbolic variables inside functions that do not overwrite global ones?
Consider the behaviour of the following function:
k, c = var('k c')
q = k * c
show(q)
def dummy():
q = 4
dummy()
show(q)
Before and after the function runs, q stores kc.
But now consider the function
k, c = var('k c')
q = k * c
show(q)
def dummy():
q = var('q')
dummy()
show(q)
But now, after the function returns, the value of q has changed to q.
How can I write a "safe" function such that any dummy variable I create inside does not overwrite a global variable? reset() and restore() both result in an undefined error.