Peter_Parker

48 Reputation

6 Badges

8 years, 323 days

MaplePrimes Activity


These are replies submitted by Peter_Parker

Thank you so much for this Preben. You don't know what a life saver you were. I had written this programme for a course I am doing and at the last minute when I had to submit it I spotted this error, panicked and just couldn't fix it. I was at near disaster because I just felt bad and felt everything was wrong with the programme and could have easily messed up the code while panicking. Had it not been for your help I would not have met the deadline. With no one else to ask at 2am I am so grateful that you were able to help and responded in the time you did. Thanks a million. I hope I can get as good as you are and likewise help others.

Much Appreciated.

 

Thank you so much for this Preben. You don't know what a life saver you were. I had written this programme for a course I am doing and at the last minute when I had to submit it I spotted this error, panicked and just couldn't fix it. I was at near disaster because I just felt bad and felt everything was wrong with the programme and could have easily messed up the code while panicking. Had it not been for your help I would not have met the deadline. With no one else to ask at 2am I am so grateful that you were able to help and responded in the time you did. Thanks a million. I hope I can get as good as you are and likewise help others.

Much Appreciated.

 

When I change = to := it does not work. Maple says

 Error, invalid input: MultiSeries:-series expects its 2nd argument, eqn, to be of type {name, name = algebraic}, but received 1.*I

Here I don't think I need a variaable assignment just an =.  Did it work for you when you changed the equal sign ? In the other post I made I had with a similar routine I had = and not := and that code worked and got rid of the u but here I can't see why it doesn't.

The one that worked looked like this.

A_0 := VectorCalculus[`*`](VectorCalculus[`*`](VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, phi))))^2, VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, psi))))), 1/VectorCalculus[`+`](1, VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, phi))))^2));

> s1:= remove(has,A_0,psi);

 

with(MultiSeries); _EnvExplicit := true; s2:=subs(cos(k*phi)=((1-u^2) / (1+u^2)), cos(m*phi)=((1-u^2) / (1+u^2)), sin(m*phi)=((2*u) / (1+u^2)),sin(k*phi)=((2*u) / (1+u^2)), s1)*1/(1 + u^2); poles1 := singular(s2, u); t1a := map(`@`(rhs, op), [poles1]); p1 := proc (beta, Q, P) options operator, arrow: select(proc (x) options operator, arrow; 0 < Im(evalf(eval(x, [beta=beta, Q=Q, P=P]))) end proc, t1a) end proc; t1 := p1(beta,Q,P); poles2 := []; for i to nops(t1) do u = t1[i]; poles2 := [op(poles2), %] end do; poles := poles2; residues1 := zip(proc (x, y) options operator, arrow; simplify(x*(lhs-rhs)(y)) end proc, `~`[convert](`~`[MultiSeries:-series](s2, poles, 1), polynom), poles);

 

residue_total1 := 0;

 

for i to nops(residues1) do residue_total1 := simplify(residue_total1 + residues1[i], size) end do;

 

result1 := simplify(((2*Pi*I)*residue_total1),size);

 

I have the cos(k*phi) and so on substitutions because I will at some point use expressions with cosine. Also Preben thank you so much for your previous help.

 

When I change = to := it does not work. Maple says

 Error, invalid input: MultiSeries:-series expects its 2nd argument, eqn, to be of type {name, name = algebraic}, but received 1.*I

Here I don't think I need a variaable assignment just an =.  Did it work for you when you changed the equal sign ? In the other post I made I had with a similar routine I had = and not := and that code worked and got rid of the u but here I can't see why it doesn't.

The one that worked looked like this.

A_0 := VectorCalculus[`*`](VectorCalculus[`*`](VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, phi))))^2, VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, psi))))), 1/VectorCalculus[`+`](1, VectorCalculus[`+`](1/VectorCalculus[`*`](2, Pi), VectorCalculus[`*`](10, sin(VectorCalculus[`*`](k, phi))))^2));

> s1:= remove(has,A_0,psi);

 

with(MultiSeries); _EnvExplicit := true; s2:=subs(cos(k*phi)=((1-u^2) / (1+u^2)), cos(m*phi)=((1-u^2) / (1+u^2)), sin(m*phi)=((2*u) / (1+u^2)),sin(k*phi)=((2*u) / (1+u^2)), s1)*1/(1 + u^2); poles1 := singular(s2, u); t1a := map(`@`(rhs, op), [poles1]); p1 := proc (beta, Q, P) options operator, arrow: select(proc (x) options operator, arrow; 0 < Im(evalf(eval(x, [beta=beta, Q=Q, P=P]))) end proc, t1a) end proc; t1 := p1(beta,Q,P); poles2 := []; for i to nops(t1) do u = t1[i]; poles2 := [op(poles2), %] end do; poles := poles2; residues1 := zip(proc (x, y) options operator, arrow; simplify(x*(lhs-rhs)(y)) end proc, `~`[convert](`~`[MultiSeries:-series](s2, poles, 1), polynom), poles);

 

residue_total1 := 0;

 

for i to nops(residues1) do residue_total1 := simplify(residue_total1 + residues1[i], size) end do;

 

result1 := simplify(((2*Pi*I)*residue_total1),size);

 

I have the cos(k*phi) and so on substitutions because I will at some point use expressions with cosine. Also Preben thank you so much for your previous help.

 

sigma > 0 and k is a positive integer in all cases.

For s2 and for expressions in general that need to be integrated via the residue theorm if the singularities are found and the ones with positive imaginary parts are selected and the residues calculated at these poles then the integral is 2*Pi*I times the sum of the residues - right? So why do you state above " If beta≠0 and Q≠0, the poles and residues can be found as...". 

I mean the singularities of s2 are just what they are so taking the ones with positive imaginary parts and getting the residue for those poles should give the value of the integral - case closed right ? Why is it necessary to go through different cases for the values of beta and Q ? I mean like where you state "If beta=0, then s2 is...". 

 

Can't I just do singular(s2,u), select the poles with positive imaginary parts, get the residues at these poles and then do 2*Pi*I times this sum to get my integral of s2 ?

I'd be grateful for your feedback.

For s2 and for expressions in general that need to be integrated via the residue theorm if the singularities are found and the ones with positive imaginary parts are selected and the residues calculated at these poles then the integral is 2*Pi*I times the sum of the residues - right? So why do you state above " If beta≠0 and Q≠0, the poles and residues can be found as...". 

I mean the singularities of s2 are just what they are so taking the ones with positive imaginary parts and getting the residue for those poles should give the value of the integral - case closed right ? Why is it necessary to go through different cases for the values of beta and Q ? I mean like where you state "If beta=0, then s2 is...". 

 

Can't I just do singular(s2,u), select the poles with positive imaginary parts, get the residues at these poles and then do 2*Pi*I times this sum to get my integral of s2 ?

I'd be grateful for your feedback.

> Okay so I can see how to get the poles. But I have some further questions.

 

 

1) For beta AND Q both GREATER THAN 0 WHICH poles have positive imaginary part and is there a PROGRAMMATIC way of selecting these ones?

 

2) How do I calculate the residue at these poles? The approach given by Alec above seems useful and is much appreciated but I can't make it work. When I put the whole code into Maple at first there is an error message saying there is a missing semicolon but when I remove the tilde (squiggle ~) after op, convert and series I get the poles outputted but am told

 

  Error, `MultiSeries` does not evaluate to a module.

 

I am using Maple 9 and I am guessing multiseries is not available as when I input with(MultiSeries) Maple does not recognise the call.

 

 

 

with(MultiSeries);

 

Error, invalid input: with expects its 1st argument, pname, to be of type {package, module}, but received MultiSeries

 

So I tried using the Maple built in residue package as below for example using the first one of the poles but it will not evaluate.

 

 

s2 := (1/2/Pi+2*Q*u/(1+u^2))^2/((1+beta^2*(1/2/Pi+2*Q*u/(1+u^2))^2)*(1+u^2));

u6:= -2*beta*Q*Pi*(beta+2*I*Pi)/(4*Pi^2+beta^2)+(4*beta^4*Q^2*Pi^2+16*I*beta^3*Q^2*Pi^3-16*Pi^4*beta^2*Q^2-16*Pi^4-8*Pi^2*beta^2-beta^4)^(1/2)/(4*Pi^2+beta^2);

residue(s2,u=u6);

 

I guess hence the need for multiseries – on what version of maple did multiseries get introduced? So is there any other way of evaluating the residues?

 

I also tried using the formula for calculating residues and taking limits but this did not evaluate either.

 

> test5:=diff((u-u6)*s2, u);

> limit(test5,u=u6);

 

 

So in summary how do I select the poles with positive imaginary parts programmatically for beta and Q > 0 and how do I get the residues calculated?

 

Alec I notice you say that if beta>0, the 2nd, 3rd, and 6th poles have positive imaginary part but what if both beta and Q are greater than 0?

> Okay so I can see how to get the poles. But I have some further questions.

 

 

1) For beta AND Q both GREATER THAN 0 WHICH poles have positive imaginary part and is there a PROGRAMMATIC way of selecting these ones?

 

2) How do I calculate the residue at these poles? The approach given by Alec above seems useful and is much appreciated but I can't make it work. When I put the whole code into Maple at first there is an error message saying there is a missing semicolon but when I remove the tilde (squiggle ~) after op, convert and series I get the poles outputted but am told

 

  Error, `MultiSeries` does not evaluate to a module.

 

I am using Maple 9 and I am guessing multiseries is not available as when I input with(MultiSeries) Maple does not recognise the call.

 

 

 

with(MultiSeries);

 

Error, invalid input: with expects its 1st argument, pname, to be of type {package, module}, but received MultiSeries

 

So I tried using the Maple built in residue package as below for example using the first one of the poles but it will not evaluate.

 

 

s2 := (1/2/Pi+2*Q*u/(1+u^2))^2/((1+beta^2*(1/2/Pi+2*Q*u/(1+u^2))^2)*(1+u^2));

u6:= -2*beta*Q*Pi*(beta+2*I*Pi)/(4*Pi^2+beta^2)+(4*beta^4*Q^2*Pi^2+16*I*beta^3*Q^2*Pi^3-16*Pi^4*beta^2*Q^2-16*Pi^4-8*Pi^2*beta^2-beta^4)^(1/2)/(4*Pi^2+beta^2);

residue(s2,u=u6);

 

I guess hence the need for multiseries – on what version of maple did multiseries get introduced? So is there any other way of evaluating the residues?

 

I also tried using the formula for calculating residues and taking limits but this did not evaluate either.

 

> test5:=diff((u-u6)*s2, u);

> limit(test5,u=u6);

 

 

So in summary how do I select the poles with positive imaginary parts programmatically for beta and Q > 0 and how do I get the residues calculated?

 

Alec I notice you say that if beta>0, the 2nd, 3rd, and 6th poles have positive imaginary part but what if both beta and Q are greater than 0?

Now I am empowered to use op in other parts of the program

Now I am empowered to use op in other parts of the program

Axel thanks for your help.

 

In your last post are you saying that '2 times' what you have written is the result of the evaluation of the integral I posted originally? If so, then how did you get this ?

Axel thanks for your help.

 

In your last post are you saying that '2 times' what you have written is the result of the evaluation of the integral I posted originally? If so, then how did you get this ?

Page 1 of 1