Re: NIntegrate with change of variables
- To: mathgroup at smc.vnet.net
- Subject: [mg77494] Re: NIntegrate with change of variables
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 10 Jun 2007 07:23:46 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f4drmk$gli$1@smc.vnet.net>
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