Hello, I am trying to simplify a complicated expression through variable substitution and part of the expression looks like:
$2A_1^2+A_1B_2+2B_1^2-B_2A_1+2C_1^2+C_1D_2+2D_1^2-D_2C_1$
I want to substitute $A_1^2+B_1^2+C_1^2+D_1^2$ with $h_1^2$ and substitute $A_1B_2-B_2A_1+C_1D_2-D_2C_1$ with $h_{12}$ and finally the expression would become $2h_1^2+h_{12}$.
I have tried to use /.
to replace, however, it seems that Mathematica is not able to do the substitution when the expression don't explicitly contain the part to be substituted.
What's more, I also tried to use Solve
and Reduce
method. But as I am new to Mathematica, I cannot get a simple expression from Reduce
(the results are divided into several conditions like B1=0&&B2=0
) and I cannot get a desired result from Solve
.
Could anybody give some examples on how to do this? Thanks in advance!!