I'm trying to change the form of some electrical engineering expressions. One transformation that can help add insight is noticing when two resistances are in parallel. The equation for this would be:
$R_{parallel}=\frac{R_1 R_2}{R_1+R_2}$
I'm still pretty new at Mathematica, but looking at the documentation of Simplify, I believe I might be able to make some TransformationFunction
to add to TransformationFunctions
. I looked at the documentation for TransformationFunctions
and the two examples look completely different than the types of equations I've seen people using on StackExchange.
I've tried using the following:
par[e_] := e /. {R1 R2/(R1 + R2) -> Rparallel}
Simplify[R1 R2/(R1 + R2), TransformationFunctions -> {Automatic, par}]
and I get back Rparallel
like I expect. However, if I try
Simplify[R1 R1 R2/(R1 + R2), TransformationFunctions -> {Automatic, par}]
I get (R1^2 R2)/(R1 + R2)
instead. I would have expected to get R1 Rparallel
.
I know that there are other problems with this, for example that the transformed name should depend on the input names (for example R1 and R2 should produce R1R2Parallel), but I'm trying to get the first issue fixed first.