Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
documentation:language_reference:objects:responsefunction:operations:sub [2024/12/17 16:13] – created Maurits W. Haverkortdocumentation:language_reference:objects:responsefunction:operations:sub [2024/12/22 16:18] (current) Maurits W. Haverkort
Line 3: Line 3:
  
 ### ###
-alligned paragraph text+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.
 ### ###
  
Line 9: Line 9:
  
 ### ###
-description text+For the case where the poles in $G_2$ are also present in $G_1$ we find
 ### ###
  
 ==== Input ==== ==== Input ====
 <code Quanty Example.Quanty> <code Quanty Example.Quanty>
--- some example code+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)
 </code> </code>
 +with the output
 +==== Result ====
 +<file Quanty_Output>
 +{ { 0 , -1 , 0 , 1 } , 
 +  { 0.1 , 0.1 , 0.3 } ,
 +  name = G1 ,
 +  type = ListOfPoles ,
 +  mu = 0 }
 +</file>
  
 +
 +===== Example =====
 +
 +###
 +For the case where the poles in $G_2$ not present in $G_1$ we find
 +###
 +
 +==== Input ====
 +<code Quanty Example.Quanty>
 +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)
 +</code>
 +with the output
 ==== Result ==== ==== Result ====
 <file Quanty_Output> <file Quanty_Output>
-text produced as output+{ { 0 , -1 , 0 , 5 , 6 } ,  
 +  { 0.1 , 0.1 , 0.25 , 0.15 } , 
 +  name = G1 , 
 +  mu = 0 , 
 +  type = ListOfPoles }
 </file> </file>
 +
 +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$.
  
 ===== Table of contents ===== ===== Table of contents =====
 {{indexmenu>../#2|tsort}} {{indexmenu>../#2|tsort}}
  
Print/export