We can subtract two response functions from each other. Note that the residue of a pole always needs to be positive. For $G = G_1 - G_2$ we start by setting $G=G_1$. For each pole in $G_2$ we look for the poles in $G_1$ at the same energy (a's). If this is present we subtract the residue of $G_2$ (b's) from $G$. If $G_2$ contains a pole at an energy that is not present in $G_1$ we subtract the residue from the pole with lower and higher energy such that the first moment locally is conserved.
For the case where the poles in $G_2$ are also present in $G_1$ we find
a1 = {0, -1,-0.5, 0, 0.5, 1, 1.5} b1 = { 0.2, 0.4, 0.2, 0.4, 0.6, 0.2} G1 = ResponseFunction.New( {a1,b1,mu=0,type="ListOfPoles", name="G1"} ) a1 = {0, -1,-0.5, 0, 0.5, 1, 1.5} b1 = { 0.1, 0.4, 0.1, 0.4, 0.3, 0.2} G2 = ResponseFunction.New( {a1,b1,mu=0,type="ListOfPoles", name="G2"} ) G3 = G1-G2 print(G3)
with the output
{ { 0 , -1 , 0 , 1 } , { 0.1 , 0.1 , 0.3 } , name = G1 , type = ListOfPoles , mu = 0 }
For the case where the poles in $G_2$ not present in $G_1$ we find
a1 = {0, -1, 0, 5, 6} b1 = { 0.2, 0.2, 0.3, 0.3} G1 = ResponseFunction.New( {a1,b1,mu=0,type="ListOfPoles", name="G1"} ) a1 = {0, -0.5, 5.75} b1 = { 0.2, 0.2} G2 = ResponseFunction.New( {a1,b1,mu=0,type="ListOfPoles", name="G2"} ) G3 = G1-G2 print(G3)
with the output
{ { 0 , -1 , 0 , 5 , 6 } , { 0.1 , 0.1 , 0.25 , 0.15 } , name = G1 , mu = 0 , type = ListOfPoles }
The pole in $G_2$ at energy $-0.5$ is equally divided between the poles at $-1$ and $0$ in $G_1$, such that each of these residues is reduced by $0.2/2=0.1$. The pole in $G_2$ at energy $5.75$ is divided between the poles at $5$ and $6$ in $G_1$. In oder to conserve the first moment we subtract $0.2 * (5.75 - 5) / (6-5) = 0.15$ from the residue at $6$ in $G_1$ and $0.2 * (6 - 5.75) / (6-5) = 0.05$ from the residue at $5$ in $G_1$.