MathGroup Archive 2013

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

Search the Archive

Re: Problem with change of variables in an integral

  • To: mathgroup at
  • Subject: [mg131613] Re: Problem with change of variables in an integral
  • From: Alex Krasnov <akrasnov at>
  • Date: Wed, 11 Sep 2013 03:51:54 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <>

Mathematica by default evaluates the function arguments before applying 
the function definitions. See the following documentation:

In this case, the arguments to ReplaceAll, the first of which is the 
Integrate expression, evaluate before the built-in ReplaceAll definition 
applies. If f is defined, then the Integrate expression evaluates to a 
closed form, so the variable substitution fails. If f is undefined, then 
the Integrate expression evaluates to itself, so the variable substitution 
succeeds. One can achieve delayed evaluation by setting the HoldFirst 
attribute on ReplaceAll or by using the Hold wrapper or the special 
Unevaluated wrapper on the first argument to ReplaceAll. See the following 

Of course, one must transform the integrand, the differential and the 
bounds. Here is a partial solution based on a previous solution:

SetAttributes[Transform, HoldFirst];
Transform[Integrate[fx_, {x_, xa_, xb_}], xt_, tx_, t_] :=
 	Integrate[(fx /. x -> xt)*D[xt, t], {t, tx /. x -> xa, tx /. x -> xb}];

One must provide t(x) in addition to x(t) in order to transform the 
bounds, though one can produce t(x) from x(t) internally using Solve or a 
similar function. Example:

In:	Transform[Integrate[Sqrt[1-x^2], {x, 0, 1}], Sin[t], ArcSin[x], t]
Out:	Pi/4

In the original question, it is unclear whether the desired bounds are for 
z or for r. If the former, then:

In:	Transform[Integrate[1/(1+z^3), {z, 0, Infinity}], r*E^(I*((2*Pi)/3)), z/E^(I*((2*Pi)/3)), r]
Out:	(2*Pi)/(3*Sqrt[3])

If the latter, then:

In:	Transform[Integrate[1/(1+z^3), {z, 0, Infinity*E^(I*((2*Pi)/3))}], r*E^(I*((2*Pi)/3)), z/E^(I*((2*Pi)/3)), r]
Out:	(2*(-1)^(2/3)*Pi)/(3*Sqrt[3])


On Tue, 10 Sep 2013, Alexei Boulbitch wrote:

> Dear Alexei,
> Integrate[...] in Map[...] will be evaluated first before Map can apply ReplaceAll[...], so nothing is done by Map.
> There is a typo in
> Integrate[E^(i \[Phi])/(1 + (E^(i \[Phi]) r)^3), {r, 0, \[Infinity]}]
> i needs to be changed to I. Then it will produce the same result.
> Transforming integrals by change of variables is not straightforward in Mathematica, especially if the integral can be evaluated in closed form. One method involves wrapping the integral with Hold or HoldForm so that evaluation is not done. In addition, simple replacement of the integration variables will not work and the integrand must be divided by the Jacobian corresponding to the variable transformation.
> Another method is to write a customized code based on the box language of Mathematica to interpret the 2-D form of integrals, which does not evaluate the integrals but does so only when asked. This is what is done in the SymbolicComputing package (, WTC 2011). The commands are:
> <<SymbolicComputing`
> SCTransInt[\[Integral]f[z] \[DifferentialD]z,
>  TransVar -> {z, r, z == r E^(I \[Phi])},
>  ReplVar -> {r, 0, \[Infinity]}] /. \[Phi] -> 2 \[Pi]/3
> It is to be noted that once the package is loaded, integrals, products and sums in 2-D form are not evaluated. Evaluation can be done using the functions SCEvalInt, SCEvalProd, and SCEvalSum, respectively. Kernel functions Integrate, Product, and Sum are the same and can be used for immediate evaluation.
> Sincerely,
> Youngjoo Chung
> Dear Youngjoo,
> Thank you for explanations. It is very helpful. I would like to ask you to give few more details.
> First of all, you write that the Integrate statement evaluates before the other ones. Since it is a very important information please give me kindly a reference to the place in the documentation, where this is written.
> Second, it would be very helpful, if in the light of the above statement you explain the result of the following:
> Clear[f, \[Phi]];
> Map[ReplaceAll[#, {z -> r*Exp[I \[Phi]], \[Phi] -> 2 \[Pi]/3}] &,
> Integrate[f[z], {z, 0, \[Infinity]}]]
> \!\(
> \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Infinity]\)]\(f[
> \*SuperscriptBox[\(E\), \(I\ \[Phi]\)]\ r] \[DifferentialD]\((
> \*SuperscriptBox[\(E\), \(I\ \[Phi]\)]\ r)\)\)\)
> Thank you for the pointing out my stupid mistake with i instead of I, this, indeed, explains the result I got. The reference to your package is also very helpful. Thank you.
> Best regards, Alexei
> Alexei BOULBITCH, Dr., habil.
> IEE S.A.
> ZAE Weiergewan,
> 11, rue Edmond Reuter,
> L-5326 Contern, LUXEMBOURG
> Office phone :  +352-2454-2566
> Office fax:       +352-2454-3566
> mobile phone:  +49 151 52 40 66 44
> e-mail: alexei.boulbitch at

  • Prev by Date: Re: Wrong result of Integrate with assumptions -- my
  • Next by Date: Re: DelayedRule assembly
  • Previous by thread: Re: Problem with change of variables in an integral
  • Next by thread: Re: Problem with change of variables in an integral