Clone(a) creates a copy of the object a.
The statement $a=b$ for objects creates two variables pointing to the same object. Changing the value of one object changes the value of the other.
A small example showing the effect on b after changing a when a=b:
-- some example codedofile("../definitions.Quanty") Opp2 = Opp1 Opp1.Name = "I'm the name of operator one" Opp2.Name = "I'm the name of operator two" print(Opp1.Name) print(Opp2.Name) psi2 = psi1 psi1.Name = "I'm the name of psi one" psi2.Name = "I'm the name of psi two" print(psi1.Name) print(psi2.Name)
I'm the name of operator two I'm the name of operator two I'm the name of psi two I'm the name of psi two
A small example showing a=Clone(b):
dofile("../definitions.Quanty") Opp2 = Clone(Opp1) Opp1.Name = "I'm the name of operator one" Opp2.Name = "I'm the name of operator two" print(Opp1.Name) print(Opp2.Name) psi2 = Clone(psi1) psi1.Name = "I'm the name of psi one" psi2.Name = "I'm the name of psi two" print(psi1.Name) print(psi2.Name)
I'm the name of operator one I'm the name of operator two I'm the name of psi one I'm the name of psi two
A small example showing that operations acting on objects lead to cloning the object:
dofile("../definitions.Quanty") Opp = Opp1 + Opp2 Opp.Name = "I'm the name of operator Opp and different from Opp1 and Opp2" print(Opp1.Name) print(Opp2.Name) print(Opp.Name)
Lx Ly I'm the name of operator Opp and different from Opp1 and Opp2