FCDiffEqChangeVariables
FCDiffEqChangeVariables[mat, x, y, rule, yOfX]
applies a variable transformation from x
to y
described by rule
, where yOfX
denotes y ( x ) y(x) y ( x ) . Here mat
is a matrix in the context of differential equations, i.e. it can be either the matrix A \mathcal{A} A or B \mathcal{B} B from the pre-canonical F ′ = A F F' = \mathcal{A} F F ′ = A F or canonical G ′ = ε B G G' = \varepsilon \mathcal{B} G G ′ = ε B G form, or the transformation matrix T \mathcal{T} T with F = T G F = \mathcal{T} G F = T G .
By default, the transformation also includes the prefactor 1 / f ′ ( y ) 1/f'(y) 1/ f ′ ( y ) . This is correct for A \mathcal{A} A or B \mathcal{B} B but not for T \mathcal{T} T matrices. The inclusion of the prefactor can be disabled by setting the option Prefactor
to False
.
See also
Overview .
Examples
mat = {{ (- 2 * (- 1 + eps))/ x , 0 , 0 , 0 }, { 0 , (1 - eps)/ x , 0 , 0 }, { 0 , (- 2 * (- 1 + eps))/ (x * (- 1 + 4 * x )),
(- 2 * (- 1 + 2 * eps))/ (- 1 + 4 * x ), 0 }, { (- 2 * (- 1 + eps))/ (x * (- 1 + 4 * x )), 0 , 0 ,
(- 1 + eps + 6 * x - 8 * eps* x )/ (x * (- 1 + 4 * x ))}}
( − 2 ( eps − 1 ) x 0 0 0 0 1 − eps x 0 0 0 − 2 ( eps − 1 ) x ( 4 x − 1 ) − 2 ( 2 eps − 1 ) 4 x − 1 0 − 2 ( eps − 1 ) x ( 4 x − 1 ) 0 0 − 8 eps x + eps + 6 x − 1 x ( 4 x − 1 ) ) \left(
\begin{array}{cccc}
-\frac{2 (\text{eps}-1)}{x} & 0 & 0 & 0 \\
0 & \frac{1-\text{eps}}{x} & 0 & 0 \\
0 & -\frac{2 (\text{eps}-1)}{x (4 x-1)} & -\frac{2 (2 \;\text{eps}-1)}{4 x-1} & 0 \\
-\frac{2 (\text{eps}-1)}{x (4 x-1)} & 0 & 0 & \frac{-8 \;\text{eps} x+\text{eps}+6 x-1}{x (4 x-1)} \\
\end{array}
\right) − x 2 ( eps − 1 ) 0 0 − x ( 4 x − 1 ) 2 ( eps − 1 ) 0 x 1 − eps − x ( 4 x − 1 ) 2 ( eps − 1 ) 0 0 0 − 4 x − 1 2 ( 2 eps − 1 ) 0 0 0 0 x ( 4 x − 1 ) − 8 eps x + eps + 6 x − 1
matNew = FCDiffEqChangeVariables[ mat, x , y , x -> (1 - y ^ 2 )/ 4 , Sqrt [ 1 - 4 * x ], Assumptions -> { y > 0 }]
( − 4 ( eps − 1 ) y y 2 − 1 0 0 0 0 − 2 ( eps − 1 ) y y 2 − 1 0 0 0 4 − 4 eps y − y 3 1 − 2 eps y 0 4 − 4 eps y − y 3 0 0 4 eps y 2 − 2 eps − 3 y 2 + 1 y − y 3 ) \left(
\begin{array}{cccc}
-\frac{4 (\text{eps}-1) y}{y^2-1} & 0 & 0 & 0 \\
0 & -\frac{2 (\text{eps}-1) y}{y^2-1} & 0 & 0 \\
0 & \frac{4-4 \;\text{eps}}{y-y^3} & \frac{1-2 \;\text{eps}}{y} & 0 \\
\frac{4-4 \;\text{eps}}{y-y^3} & 0 & 0 & \frac{4 \;\text{eps} y^2-2 \;\text{eps}-3 y^2+1}{y-y^3} \\
\end{array}
\right) − y 2 − 1 4 ( eps − 1 ) y 0 0 y − y 3 4 − 4 eps 0 − y 2 − 1 2 ( eps − 1 ) y y − y 3 4 − 4 eps 0 0 0 y 1 − 2 eps 0 0 0 0 y − y 3 4 eps y 2 − 2 eps − 3 y 2 + 1
Setting the option Reverse
to True
allows to undo the transformation.
matCheck = FCDiffEqChangeVariables[ matNew, x , y , x -> (1 - y ^ 2 )/ 4 , Sqrt [ 1 - 4 * x ], Reverse -> True ]
( 2 − 2 eps x 0 0 0 0 1 − eps x 0 0 0 − 2 − 2 eps x − 4 x 2 2 − 4 eps 4 x − 1 0 − 2 − 2 eps x − 4 x 2 0 0 8 eps x − eps − 6 x + 1 x − 4 x 2 ) \left(
\begin{array}{cccc}
\frac{2-2 \;\text{eps}}{x} & 0 & 0 & 0 \\
0 & \frac{1-\text{eps}}{x} & 0 & 0 \\
0 & -\frac{2-2 \;\text{eps}}{x-4 x^2} & \frac{2-4 \;\text{eps}}{4 x-1} & 0 \\
-\frac{2-2 \;\text{eps}}{x-4 x^2} & 0 & 0 & \frac{8 \;\text{eps} x-\text{eps}-6 x+1}{x-4 x^2} \\
\end{array}
\right) x 2 − 2 eps 0 0 − x − 4 x 2 2 − 2 eps 0 x 1 − eps − x − 4 x 2 2 − 2 eps 0 0 0 4 x − 1 2 − 4 eps 0 0 0 0 x − 4 x 2 8 eps x − eps − 6 x + 1
Simplify [ matCheck - mat] // Flatten // Union
{ 0 } \{0\} { 0 }
FCDiffEqChangeVariables[ mat, x , y , x -> (1 - y ^ 2 )/ 4 , Sqrt [ 1 - 4 * x ], Assumptions -> { y > 0 },
Prefactor -> False ]
( 8 ( eps − 1 ) y 2 − 1 0 0 0 0 4 ( eps − 1 ) y 2 − 1 0 0 0 − 8 ( eps − 1 ) y 2 ( y 2 − 1 ) 4 eps − 2 y 2 0 − 8 ( eps − 1 ) y 2 ( y 2 − 1 ) 0 0 eps ( 8 y 2 − 4 ) − 6 y 2 + 2 y 2 ( y 2 − 1 ) ) \left(
\begin{array}{cccc}
\frac{8 (\text{eps}-1)}{y^2-1} & 0 & 0 & 0 \\
0 & \frac{4 (\text{eps}-1)}{y^2-1} & 0 & 0 \\
0 & -\frac{8 (\text{eps}-1)}{y^2 \left(y^2-1\right)} & \frac{4 \;\text{eps}-2}{y^2} & 0 \\
-\frac{8 (\text{eps}-1)}{y^2 \left(y^2-1\right)} & 0 & 0 & \frac{\text{eps} \left(8 y^2-4\right)-6 y^2+2}{y^2 \left(y^2-1\right)} \\
\end{array}
\right) y 2 − 1 8 ( eps − 1 ) 0 0 − y 2 ( y 2 − 1 ) 8 ( eps − 1 ) 0 y 2 − 1 4 ( eps − 1 ) − y 2 ( y 2 − 1 ) 8 ( eps − 1 ) 0 0 0 y 2 4 eps − 2 0 0 0 0 y 2 ( y 2 − 1 ) eps ( 8 y 2 − 4 ) − 6 y 2 + 2