A lot of times in numerical methods, I need to have a temporary variable as a time stepping tool or as an “incrementing” device without altering the original variable. A code snippet like
copy_u = u for i in range(len(copy_u)): copy_u[i] = f(u)
But I gotta be more careful. There’s a deep difference between making a copy of a variable, and just creating a reference to a variable. Any change to copy_u might change u itself! Use np.copy or the copy module in Python!