I have a complicated expression where common terms are apparent but Simplify[] and FullSimplify[] don't appear able, even with plenty of assumptions added, to reduce down to a simpler form with common terms recognised so that I can give them a symbol and simplify the expressions acordingly. A simpler example which demonstrates is
h (140 + Current -
lastU1 + (lastV1 +
1/2 h (140 + Current - lastU1 + (5 + 0.04 lastV1) lastV1)) (5 +
0.04 (lastV1 +
1/2 h (140 + Current - lastU1 + (5 + 0.04 lastV1) lastV1))))
with obvious common terms being
140 + Current - lastU1 -> Alpha
(5 + 0.04 lastV1) lastV1 -> Beta
With these and one further common term which contains them both recognised
(lastV1 + 1/2 h (Alpha + Beta)) -> Gamma
this expression can be reduced to
h (Alpha + Gamma (5 + 0.04` Gamma))
I have played with Factor[], Collect[] and many others but nothing seems to do what I need. I am sure that Mathematica is capable of doing what I am looking for, so I am asking the experts here for tips for how best to go about it.
As a matter of interest, these expressions are going to be compiled into C eventually and I have found this to produce output of interest in terms of structuring the algebraic reduction
Experimental`OptimizeExpression[ expression , OptimizationLevel -> 2]
but I would still like more control over the manipulation before I get to this stage.
Many thanks in advance
Michael