Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with change of variables in an integral

406 views
Skip to first unread message

Dr. Robert Kragler

unread,
Sep 3, 2013, 11:33:57 PM9/3/13
to

Hello,

Although I know how to make a change of variables in an integral I can only do
it manually by applying a substitution rule to the integrand and the
differential e.g
{f[z],\[DifferentialD]z}//. {z-> r E^(I
\[Phi]),\[DifferentialD]z->E^(I \[Phi]) \[DifferentialD]r,\[Phi] -> (2\[Pi])/3}

But it cannot applied this substitution rule directly to the integral, e.g.
Integrate[f[z],{z,0,\[Infinity]}] //. {z-> r E^(I
\[Phi]),\[DifferentialD]z->E^(I \[Phi]) \[DifferentialD]r,\[Phi] -> (2\[Pi])/3}

Comparing with the correct result, the exponential factor E^((2 I \[Pi])/3) =
(-1)^(2/3) is missing in the evaluation of the integral. The correct appearance
of the
integral is : Integrate[1/(1+r^3) E^((2 I \[Pi])/3),{r,0,\[Infinity]}]

How can I force Mathematica (V8) to perform the correct transformation of
variables as regards to the integral (and not to its separate parts of it as
{f[z],\[DifferentialD]z} ?

Any suggestions are appreciated.
Robert Kragler

--
Robert Kragler
Email : kra...@hs-weingarten.de
URL : http://portal.hs-weingarten.de/web/kragler

Murray Eisenberg

unread,
Sep 5, 2013, 8:11:23 AM9/5/13
to
First, I don't see how you can get the stated "correct result" unless your original function f[z] is specified -- presumably, to be 1/(1+z^3).

Second, is Phi a fixed number 2 Pi/3 or is it a new variable (so that you're attempting to write the original single integral as a double integral)? At one place you seem to be setting Phi -> 2 Pi/3, yet in your "correct result" you show what seems to be a variable Phi.
---
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower
University of Massachusetts
710 North Pleasant Street
Amherst, MA 01003-9305






Alexander Elkins

unread,
Sep 5, 2013, 8:11:43 AM9/5/13
to
Dear Dr. Robert Kragler,

Basicly the problem is two-fold. First and foremost Mathematica
performs the Integrate before doing the replacement.
Secondly \[DifferentialD]z is for display only and cannot be accessed.

In order to make it work for you we must use Hold combined with Release.
I have inferred f [z] as follows to get the integrand shown:

In[1]:= With[{f = Function[z, 1/(1 + z^3)]},
f[z] Hold[ D[z, r]] /. z -> E^((2 I \[Pi])/3) r] // Release

Out[1]= E^((2 I \[Pi])/3)/(1 + r^3)

So Integrate[1/(1 + z^3), {z, 0, \[Infinity]}] is the integral in which you
wish to replace z. Here is how to do that:

In[2]:= Hold[Integrate[1/(1 + z^3), {z, 0, \[Infinity]}]] /.
Hold[Integrate[fv_, v_]] :>
Hold[Integrate[Hold[fv D[z, r]] /. z -> E^((2 I \[Pi])/3) r // Release,
v /. z -> r]] // Release

Out[2]= (2 (-1)^(2/3) \[Pi])/(3 Sqrt[3])

Best regards,
Alexander Elkins

"Dr. Robert Kragler" <kra...@hs-weingarten.de> wrote in message
news:l069n5$atc$1...@smc.vnet.net...

Alexei Boulbitch

unread,
Sep 5, 2013, 8:12:03 AM9/5/13
to
Hello,

Although I know how to make a change of variables in an integral I can only do
it manually by applying a substitution rule to the integrand and the
differential e.g
{f[z],\[DifferentialD]z}//. {z-> r E^(I
\[Phi]),\[DifferentialD]z->E^(I \[Phi]) \[DifferentialD]r,\[Phi] -> (2\[Pi]/3}

But it cannot applied this substitution rule directly to the integral, e.g.
Integrate[f[z],{z,0,\[Infinity]}] //. {z-> r E^(I
\[Phi]),\[DifferentialD]z->E^(I \[Phi]) \[DifferentialD]r,\[Phi] -> (2\[Pi]/3}

Comparing with the correct result, the exponential factor E^((2 I \[Pi])/3) =
(-1)^(2/3) is missing in the evaluation of the integral. The correct appearance
of the
integral is : Integrate[1/(1+r^3) E^((2 I \[Pi])/3),{r,0,\[Infinity]}]

How can I force Mathematica (V8) to perform the correct transformation of
variables as regards to the integral (and not to its separate parts of it as
{f[z],\[DifferentialD]z} ?

Any suggestions are appreciated.
Robert Kragler

Hello, Robert,

Try this:

Clear[f, \[Phi]];
Map[ReplaceAll[#, {z -> r*Exp[I \[Phi]] , \[Phi] -> 2 \[Pi]/3}] &,
Integrate[f[z], {z, 0, \[Infinity]}]]

to map the replacements directly onto the structures below the Integrate operator. The result is below:

\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Infinity]\)]\(f[
\*SuperscriptBox[\(E\), \(I\ \[Phi]\)]\ r] \[DifferentialD]\((
\*SuperscriptBox[\(E\), \(I\ \[Phi]\)]\ r)\)\)\)

If it is used, for example, with the function f[z_]:=1/(1+z^3), as you tried:

Clear[f, \[Phi]];
f[z_] := 1/(1 + z^3);
Map[ReplaceAll[#, {z -> r*Exp[I \[Phi]] , \[Phi] -> 2 \[Pi]/3}] &,
Integrate[f[z], {z, 0, \[Infinity]}]]

it gives

(2 \[Pi])/(3 Sqrt[3])

When I do the same "by hand":

\[Phi] = 2 \[Pi]/3;
Integrate[Exp[I \[Phi]]/(
1 + (Exp[I \[Phi]]*r)^3), {r, 0, \[Infinity]}]

I get this:

(2 (-1)^(2/3) \[Pi])/(3 Sqrt[3])

which in my opinion is almost the same, though not entirely. I do not see, where from the difference comes.

Surprisingly strange result has been delivered, when I used Esc+e+e+Esc instead of Exp to check of how the "hand-made" transformation would work:

\[Phi] = 2 \[Pi]/3;
Integrate[E^(i \[Phi])/(1 + (E^(i \[Phi]) r)^3), {r, 0, \[Infinity]}]

The answer was:

ConditionalExpression[(2 E^((2 i \[Pi])/3) \[Pi])/(
3 Sqrt[3] (E^(2 i \[Pi]))^(1/3)),
Im[E^(-2 i \[Pi])] != 0 || Re[E^(-2 i \[Pi])] >= 0]

which I do not understand. I do it on PC, Win XP, Mathematica 9.0.1.0. I would be v=
ery interested in comments of the Community on this matter.

Best, 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.b...@iee.lu




Youngjoo Chung

unread,
Sep 8, 2013, 2:50:33 AM9/8/13
to
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 (http://symbcomp.gist.ac.kr, 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

Alexei Boulbitch

unread,
Sep 10, 2013, 3:46:11 AM9/10/13
to
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

Alex Krasnov

unread,
Sep 11, 2013, 3:45:06 AM9/11/13
to
Mathematica by default evaluates the function arguments before applying
the function definitions. See the following documentation:

http://reference.wolfram.com/mathematica/tutorial/TheStandardEvaluationProcedure.html

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
documentation:

http://reference.wolfram.com/mathematica/tutorial/NonStandardEvaluation.html

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

Alex

Youngjoo Chung

unread,
Sep 12, 2013, 11:11:25 PM9/12/13
to
Dear Alexei,

I believe the references mentioned in Alex's reply below explains the evaluation procedure well.

In your earlier message, with

f[z_] := 1/(1 + z^3);

Integrate[...] is evaluated to (2 \[Pi])/(3 Sqrt[3]) before being passed to Map. This explains the difference that you saw.

If f[z] is not known, Integrate cannot evaluate and is passed to Map as is as shown in your message. However, the following code

Clear[f, \[Phi]];
Map[ReplaceAll[#, {z -> r*Exp[I \[Phi]], \[Phi] -> 2 \[Pi]/3}] &,
Integrate[f[z], {z, 0, \[Infinity]}]]
% /. f[z_] -> z

issues an error message

Integrate::ilim: Invalid integration variable or limit(s) in {E^(I \[Phi]) r,0,\[Infinity]}. >>

and even though f[z_] = z is integrable, integration will not be done since E^(I \[Phi]) is not a valid integration variable.

Sincerely,
Youngjoo

0 new messages