Question: Assigning variable names and programmatically calculating residues?

 

> Hello Guys,

 

Please help me with this problem.

 

 

 

I generate the solutions to an equation and then I place them in a list as for example

 

> t1 := [((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), ((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), ((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), ((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2)];

 

> For the program I am writing I won't know in advance how many list items there will be. So my first problem is as follows. I now want to assign each of the list items (in t1) a DIFFERENT variable name. So I have attempted to do this as below but can't quite get it right. Could you please assist me with this or give some recommendation.

 

 

 

> u:=0;

 

for z in t1 do

 

ui:= z;

 

end do;

 

> # This leads to my second problem. I now want to take the residue of a given function at each of the list elements in t1 that have been assigned to the different variable names above. I am thinking that if I made a list out of the variable assignments, that is the ui's above then I could take an approach like in the psuedocode below

 

 

 

>

 

 

 

For each ui in 'the list'

residuei:= residue(equation, u=ui); end do;

 

 

 

 

 

> But how could I go about doing this? I can't make it work. I can't index the procedure properly to get it to work. I would then want to assign each of the residue values to different individual variable names for further use.But I am struggling to see how to do this also. :)

 

 

 

So to summarise what I want to do in a programmatic way is having obtained the solutions to an equation I want to assign all the solutions to different labels (variable assignment). I then want to calculate the residue of my equation at each of these variable assignments. Then I want to assign the value of the residue at each of these solutions (poles) to another set of variables - similar to what would be done in my 'first problem' above. Please help, guide me with this. I would be ever so grateful as I completely stuck and unable to move the program development forward.

 

Please Wait...