Re: Variable transformations
- To: mathgroup at smc.vnet.net
- Subject: [mg131443] Re: Variable transformations
- From: "Kevin J. McCann" <kjm at KevinMcCann.com>
- Date: Tue, 23 Jul 2013 17:20:26 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <kslfml$po0$1@smc.vnet.net>
Here is some code that I think I found, but may have written, a long
time ago.
First the Function. The key is the Nest, which takes care of the
derivatives.
Clear[COV, DEQ, \[Psi], x, z, f, n]
COV::usage =
"COV[DEQ,\[Psi],x,z,f] changes the independent variable in a \
differential equation from x to z where x=f[z]. \[Psi] is the \
dependent variable or
function we are solving for.";
COV[DEQ_, \[Psi]_, x_, z_,
f_] := (DEQ /. {D[\[Psi][x], {x, n_Integer}] :>
Nest[(D[#, z]/D[f, z]) &, \[Psi][z], n], \[Psi][x] :> \[Psi][z],
x :> f}
)
Here is an example of the usage:
de = -(\[HBar]^2/(2 m)) \!\(
\*SubscriptBox[\(\[PartialD]\), \({x, 2}\)]\(\[Psi][x]\)\) +
1/2 m \[Omega]^2 x^2 \[Psi][x] - e \[Psi][x]
COV[de, \[Psi], x, z, \[Alpha] z + \[Beta]]
Hope this helps,
Kevin
On 7/23/2013 4:43 AM, Nicholas Chisholm wrote:
> Say I have some differential equation in terms of the independent variable
>
> Thanks!
>