MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NIntegrate with change of variables


chuck009 wrote:
> Hi,
> 
> I'm working on contour integrals using NIntegrate.  Can I specify a transformation rule that would replace both the variable of integration as well as the differential?  For example, suppose I wish to integrate f(z)dz around the unit circle, that is z=Exp[i t].  Well I could make the transformation:
> 
> NIntegrate[f[z] /. z->Exp[i t],{t,-pi, pi}] but that does not replace dz with its equivalent in terms of t, that is:
> 
> dz=i Exp[i t] dt
> 
> The correct form to integrate would be:
> 
> NIntegrate[f[Exp[i t]] i Exp[i t],{t,-pi, pi}]
> 
> Is there a way to define a transformation rule that would make both those substitutions for unspecified z=g(t)?

You can define a function that handles both the change of variable and 
the chain rule [1]. For instance,

In[1]:=
ContourIntegrate[f_, par : (z_ -> g_), {t_, a_, b_}] :=
    NIntegrate[Evaluate[(f /. par)*D[g, t]], {t, a, b}]

ContourIntegrate[1/(z - 1/2), z -> Exp[I*t]*(2*Cos[t] + 1),
    {t, -Pi, Pi}]

Out[2]=
            -17
-5.55112 10    + 12.5664 I

Regards,
Jean-Marc

[1] "Contour integral" 
http://forums.wolfram.com/mathgroup/archive/1998/Feb/msg00100.html



  • Prev by Date: Re: 3D interpolation (Repost for character table problem)
  • Next by Date: matrix identity pointers
  • Previous by thread: NIntegrate with change of variables
  • Next by thread: Re: NIntegrate with change of variables