Re: Change integral variables
- To: mathgroup at smc.vnet.net
- Subject: [mg88216] Re: Change integral variables
- From: samuel.blake at maths.monash.edu.au
- Date: Mon, 28 Apr 2008 04:41:23 -0400 (EDT)
- References: <fv1fep$es1$1@smc.vnet.net>
On Apr 27, 7:02 pm, Budaoy <yaomengli... at gmail.com> wrote:
> In Mathematica, how can I change integral variables? For example in
> integration:
>
> Integrate[Sin[Sqrt[x]], x] if I want to use t^2=x to instead x in the
> integral, how can I achieve this?
>
> PS: Does Mathematica have a inertial form of some symbolic command,
> for instance, the above integration, if I only want an integration
> form but not an answer, what can I do?
>
> Thanks.
Greetings,
The following is a rough implementation of an integration by
substitution routine....
In[87]:= IntegrateBySubstitution[integrand_, var_, sub_Equal] :=
Catch[Module[{u, substitution, du, res, x},
u = First[sub];
substitution = Last[sub];
du = D[substitution, var];
res = Simplify[(integrand /. substitution :> u)/du];
(* derivative cancels *)
If[FreeQ[res, var],
Throw[{res, u}]
];
(* use inverse function to remove var from res *)
x = First@Flatten@Solve[sub, var];
res = PowerExpand@Simplify[res /. x];
{res, u}
]]
Here is the integral you requested:
In[88]:= IntegrateBySubstitution[Sin[Sqrt[x]], x, u == Sqrt[x]]
Out[88]= {2 u Sin[u], u}
And a couple of other examples ;-)
In[89]:= IntegrateBySubstitution[(2 x)/(1 + x^2), x, u == 1 + x^2]
Out[89]= {1/u, u}
In[90]:= IntegrateBySubstitution[(2 x)/(1 + x^2), x, u == x^2]
Out[90]= {1/(1 + u), u}
In[91]:= IntegrateBySubstitution[Sqrt[1 - x + Sqrt[x]], x,
u == Sqrt[x]]
Out[91]= {2 u Sqrt[1 + u - u^2], u}
In[92]:= IntegrateBySubstitution[Sqrt[1 + Tan[x]], x, u == Tan[x]]
During evaluation of In[92]:= Solve::ifun: Inverse functions are \
being used by Solve, so some solutions may not be found; use Reduce \
for complete solution information. >>
Out[92]= {Sqrt[1 + u]/(1 + u^2), u}
Cheers,
Sam