Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: NIntegrate with change of variables

  • To: mathgroup at
  • Subject: [mg77494] Re: NIntegrate with change of variables
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Sun, 10 Jun 2007 07:23:46 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f4drmk$gli$>

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,

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}]

-5.55112 10    + 12.5664 I


[1] "Contour integral"

  • 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