On Tuesday, October 18, 2016 at 4:27:22 PM UTC-4, digxx wrote: > > do u have an example for how to use a contour? > quadgk(cis,0,1+1*im)= > probably integrates over the straight line so how can I integrate over the > line gamma(t)=t+im*t^2 >
By contour, I just meant straight-line segments. For example: quadgk(z -> 1/z, 1, 1im, -1, -1im) integrates 1/z over a closed counter-clockwise diamond-shaped contour around the origin in the complex plane, returning 2πi by the residue theorem. Of course, you can integrate over an arbitrary contour by a change of variables, but then you have to include the Jacobian factor yourself. e.g. you can integrate f(z) over z(t) from t=0..1 by doing quadgk(t -> f(z(t)) * z′(t), 0, 1), where z′(t) is dz/dt. In your example, z(t) = t + t^2*im z′(t) = 1 + 2t*im --SGJ