Are there any automated procedures to change integration variables? For example by changing Sin[u]->x, I can change
Integrate[f[Sin[u]], {u, 0, Pi/2}]
into
Integrate[f[x]/Sqrt[1 - x^2], {x, 0, 1}]
Are there any automated procedures to change integration variables? For example by changing Sin[u]->x, I can change
Integrate[f[Sin[u]], {u, 0, Pi/2}]
into
Integrate[f[x]/Sqrt[1 - x^2], {x, 0, 1}]
Here is a possibly quite naive implementation:
changeVariables[expr_, oldVar_, changeFunc_, newVar_, interval_] := With[{
inverse = InverseFunction @ changeFunc,
der = D[changeFunc @ oldVar, oldVar]
},
{
(expr /. changeFunc @ oldVar -> newVar) / (
der /. oldVar -> inverse @ newVar
),
{newVar, changeFunc @ interval[[1]], changeFunc @ interval[[2]]}
}
]
which gives the expected result, in at least simple circumstances:
Of course, as the warning reminds us, this method uses inverse functions and may, therefore, give incorrect results in some circumstances. Already in my second example had I used as integration interval $(-\infty,\infty)$ I would have got a wrong result.
In v13.1 IntegrateChangeVariables is introduced:
IntegrateChangeVariables[Inactive[Integrate][f[Sin[u]], {u, 0, Pi/2}],
x, x == Sin[u]]
(* Inactive[Integrate][f[x]/Sqrt[1 - x^2], {x, 0, 1}] *)
But this function is still marked as EXPERIMENTAL and a bit fragile, so, watch your step :) :
(* This gives incorrect result: *)
IntegrateChangeVariables[Inactive[Integrate][f[Sin[u]], {u, 0, Pi/2}],
x, Sin[u] == x]
(* Inactive[Integrate][f[Sin[x]], {x, 0, π/2}] *)
Sorry, not allowed to comment on glS' answer.
I found the following useful, which builds a rule to change variables in (all!) integrals, building on changeVariables above:
changeVariableRule[changeFunc_,
newVar_] := (Integrate[expr_, {x_, start_, stop_}] :>
Integrate @@
changeVariables[expr, x, changeFunc, newVar, {start, stop}])