I will try to be as clear as possible.
I need to calculate the derivative of a function. The result is a very long equation and I would like Mathematica to find and substitute parts naming them with an assigned symbol.
Example
I solve this system of equations:
Solution =
ToRadicals @
Refine[
Reduce[{x == AI*(L - x - 3*y), y == AJ*(L - x - 3*y)^3}, {x,y}, Reals],
Assumptions -> L > 0 && AI > 0 && AJ > 0
]
where the variables AI
and AJ
represent exponential functions with some coefficients before.
At this point I differentiate this function with respect to v
, expanding AI
and AJ
(because they contain the variable v
inside):
D[
Last @ ReplaceAll[
Solution[[1]],
{
AI -> BI*aaI*kI*Exp[-(ZI/VTH)*(v - VREF)],
AJ -> BJ*aaJ*kJ*Exp[-(ZJ/VTH)*(v - VREF)]
}
],
v
]
The result is a complicated and very long expression. Is there a way to simplify the resulting expression by regrouping back all the AI
and AJ
?
ReplaceAll
does not work properly because the pattern does not appear as the original expression (they are separated by the internal simplification)
I think I should change the way I'm doing this, but I'm new with Mathematica and I could not find any similar question.
v
? As insolution = Refine[Reduce[{x == AI*(L - x - 3*y), y == AJ*(L - x - 3*y)^3}, {x, y}, Reals], Assumptions -> L > 0 && AI > 0 && AJ > 0][[1, 2]] /. {AI -> AI[v], AJ -> AJ[v]}
. Now it can be differentiated with respect tov
and no substitution is needed unless and until you want to express in terms of the original larger terms. $\endgroup$ – Daniel Lichtblau Aug 8 '18 at 17:45