[sage-support] Re: why is this contour integral wrong?
On Dec 6, 3:26 pm, kcrisman wrote: > > The problem is that the integral should not depend on the center of > > the circle > > containing the pole. It looks like maxima bug (?) > > I've reported this > athttps://sourceforge.net/tracker/?group_id=4933&atid=104933 > > Dan, if you want to open a ticket, just be sure to refer to that. It is nice (but slightly dangereous) that: sage: pari('f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3))') (z)->(z-I)*(z-1)^2/(z-(-1/2-I/3)) sage: pari('intcirc(z=-1/2-I/3,1,f(z))')==pari('intcirc(z=0,2,f(z))') True (Since the calculation is numerical, the equality is modulo pari default precision) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
> The problem is that the integral should not depend on the center of > the circle > containing the pole. It looks like maxima bug (?) I've reported this at https://sourceforge.net/tracker/?group_id=4933&atid=104933 Dan, if you want to open a ticket, just be sure to refer to that. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
> > Applying expand(ratsimp( )); to your %o15 one can obtain Dan's result. > > The problem is that the integral should not depend on the center of > the circle > containing the pole. It looks like maxima bug (?) Sometimes ago there was an example of failing complex calculations on ask.sagemath.org http://ask.sagemath.org/question/839/unexpected-behavior-of-log-in-complex-plane I don't know if this is in any way related or was followed up with a bug report upstream or a ticket, but maybe it is related and should not be overlooked. best emil -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
On Dec 5, 4:56 pm, kcrisman wrote: > So it sounds like you should file a ticket, Dan. Maybe we're just > sending it to Maxima wrong. > > (%i9) f(z):=(z-%i)*(z-1)^2/(z-(-1/2-%i/3)); > 2 > (z - %i) (z - 1) > (%o9) f(z) := - > - 1 %i > z - (--- - --) > 2 3 > (%i14) display2d:false; > > (%o14) false > (%i15) integrate(f(-1/2-%i/3+exp(%i*t))*%i*exp(%i*t),t,0,2*%pi); > > (%o15) %i*((4*%i-13)/3-((724*%i-57)*%pi+144*%i-468)/108) > > (%i17) rectform(%i*((4*%i-13)/3-((724*%i-57)*%pi+144*%i-468)/108)); > > (%o17) (724*%pi+144)/108+%i*(-(-57*%pi-468)/108-13/3)-4/3 > > Is this right? Applying expand(ratsimp( )); to your %o15 one can obtain Dan's result. The problem is that the integral should not depend on the center of the circle containing the pole. It looks like maxima bug (?) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
So it sounds like you should file a ticket, Dan. Maybe we're just sending it to Maxima wrong. (%i9) f(z):=(z-%i)*(z-1)^2/(z-(-1/2-%i/3)); 2 (z - %i) (z - 1) (%o9) f(z) := - - 1 %i z - (--- - --) 23 (%i14) display2d:false; (%o14) false (%i15) integrate(f(-1/2-%i/3+exp(%i*t))*%i*exp(%i*t),t,0,2*%pi); (%o15) %i*((4*%i-13)/3-((724*%i-57)*%pi+144*%i-468)/108) (%i17) rectform(%i*((4*%i-13)/3-((724*%i-57)*%pi+144*%i-468)/108)); (%o17) (724*%pi+144)/108+%i*(-(-57*%pi-468)/108-13/3)-4/3 Is this right? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
On Dec 5, 10:04 am, achrzesz wrote: > On Dec 5, 5:31 am, Dan Drake wrote: > > > > > I keep wondering whether Sage is making a mistake, or I'm not > > understanding complex analysis. I'm a little afraid to learn the answer. > > :) > > > Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere > > except at -1/2-I/3, where it has a simple pole. So, if I integrate over > > a circle centered at 0 of radius, say, 2, the answer should be > > > 2*pi*I*(residue of f at -1/2 - I/3), > > > which is pi*(181/27 + 19*I/36). However, when I try to do the contour > > integral, I get: > > > sage: integrate(f(2*exp(I*t)) * 2*I*exp(I*t), (t, 0, 2*pi)) > > 0 > > > even though the contour encloses the pole. It works if I center the > > circle around the pole: > > > sage: integrate(f(-1/2-I/3 + exp(I*t)) * I*exp(I*t), (t, 0, 2*pi)) > > (19/36*I + 181/27)*pi > > > and also if I integrate over the square with vertices 1+i, 1-i, -1-i, > > -1+i. What's wrong with the circle at the origin? > > > Note that Mathematica gets this right, although you need to ask for full > > simplification: with f[z_] = (z-I)*(z-1)^2/(z-(-1/2-I/3)), you get > > > In[5]:= Integrate[f[2*Exp[I*t]] * 2*I*Exp[I*t], {t, 0, 2*Pi}]//FullSimplify > > > 181 19 I > > Out[5]= (--- + ) Pi > > 27 36 > > > Any ideas? > > > Dan > > > -- > > --- Dan Drake > > - http://mathsci.kaist.ac.kr/~drake > > --- > > > signature.asc > > < 1KViewDownload > > sage: maxima('rectform(2*%pi*%i*residue((z-%i)*(z-1)^2/(z-(-1/2-%i/ > 3)),z,-1/2-%i/3))').sage() > (19/36*I + 181/27)*pi sage: f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)) sage: 2*pi*I*f(z).maxima_methods().residue(z,-1/2 - I/3) (19/36*I + 181/27)*pi -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
On Dec 5, 5:31 am, Dan Drake wrote: > I keep wondering whether Sage is making a mistake, or I'm not > understanding complex analysis. I'm a little afraid to learn the answer. > :) > > Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere > except at -1/2-I/3, where it has a simple pole. So, if I integrate over > a circle centered at 0 of radius, say, 2, the answer should be > > 2*pi*I*(residue of f at -1/2 - I/3), > > which is pi*(181/27 + 19*I/36). However, when I try to do the contour > integral, I get: > > sage: integrate(f(2*exp(I*t)) * 2*I*exp(I*t), (t, 0, 2*pi)) > 0 > > even though the contour encloses the pole. It works if I center the > circle around the pole: > > sage: integrate(f(-1/2-I/3 + exp(I*t)) * I*exp(I*t), (t, 0, 2*pi)) > (19/36*I + 181/27)*pi > > and also if I integrate over the square with vertices 1+i, 1-i, -1-i, > -1+i. What's wrong with the circle at the origin? > > Note that Mathematica gets this right, although you need to ask for full > simplification: with f[z_] = (z-I)*(z-1)^2/(z-(-1/2-I/3)), you get > > In[5]:= Integrate[f[2*Exp[I*t]] * 2*I*Exp[I*t], {t, 0, 2*Pi}]//FullSimplify > > 181 19 I > Out[5]= (--- + ) Pi > 27 36 > > Any ideas? > > Dan > > -- > --- Dan Drake > - http://mathsci.kaist.ac.kr/~drake > --- > > signature.asc > < 1KViewDownload sage: maxima('rectform(2*%pi*%i*residue((z-%i)*(z-1)^2/(z-(-1/2-%i/ 3)),z,-1/2-%i/3))').sage() (19/36*I + 181/27)*pi -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: why is this contour integral wrong?
On Dec 5, 5:31 am, Dan Drake wrote: > I keep wondering whether Sage is making a mistake, or I'm not > understanding complex analysis. I'm a little afraid to learn the answer. > :) > > Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere > except at -1/2-I/3, where it has a simple pole. So, if I integrate over > a circle centered at 0 of radius, say, 2, the answer should be > > 2*pi*I*(residue of f at -1/2 - I/3), > > which is pi*(181/27 + 19*I/36). However, when I try to do the contour > integral, I get: > > sage: integrate(f(2*exp(I*t)) * 2*I*exp(I*t), (t, 0, 2*pi)) > 0 > > even though the contour encloses the pole. It works if I center the > circle around the pole: > > sage: integrate(f(-1/2-I/3 + exp(I*t)) * I*exp(I*t), (t, 0, 2*pi)) > (19/36*I + 181/27)*pi > > and also if I integrate over the square with vertices 1+i, 1-i, -1-i, > -1+i. What's wrong with the circle at the origin? > > Note that Mathematica gets this right, although you need to ask for full > simplification: with f[z_] = (z-I)*(z-1)^2/(z-(-1/2-I/3)), you get > > In[5]:= Integrate[f[2*Exp[I*t]] * 2*I*Exp[I*t], {t, 0, 2*Pi}]//FullSimplify > > 181 19 I > Out[5]= (--- + ) Pi > 27 36 > > Any ideas? > > Dan > > -- > --- Dan Drake > - http://mathsci.kaist.ac.kr/~drake > --- > > signature.asc > < 1KViewDownload Note that pari has a good approximate solution: sage: pari('f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3))') (z)->(z-I)*(z-1)^2/(z-(-1/2-I/3)) sage: 2*n(pi)*I*pari('intcirc(z=0,2,f(z))') 21.0603063073982 + 1.65806278939461*I sage: CC(pi*(181/27 + 19*I/36)) 21.0603063073982 + 1.65806278939461*I Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org