Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I probably don't understand your problem : your desired expression is what is produced bu abstaining to expand and I probably do not understant your problem: your desired expression can be quite simply obtained by abstaining to expand and full_simplify the original expression:

sage: f_m.subs({b : b_m + (b_s-b_m)^3}).diff(b_m)
-(3*(b_m - b_s)^2 - 1)*a*x^(-(b_m - b_s)^3 + b_m)*log(x)

On the other hand :

sage: ex
-(3*a*b_m^2 - 6*a*b_m*b_s + 3*a*b_s^2 - a)*x^(-b_m^3 + 3*b_m^2*b_s - 3*b_m*b_s^2 + b_s^3 + b_m)*log(x)
sage: ex.subs({(b_m + (b_s-b_m)^3).expand(): b_m})
-(3*a*b_m^2 - 6*a*b_m*b_s + 3*a*b_s^2 - a)*x^b_m*log(x)

I probably don't understand your problem : your desired expression is what is produced bu abstaining to expand and I probably do not understant understand your problem: your desired expression can be quite simply obtained by abstaining to expand and full_simplify the original expression:

sage: f_m.subs({b : b_m + (b_s-b_m)^3}).diff(b_m)
-(3*(b_m - b_s)^2 - 1)*a*x^(-(b_m - b_s)^3 + b_m)*log(x)

On the other hand, you may expand the left hand of your second substitution :

sage: ex
-(3*a*b_m^2 - 6*a*b_m*b_s + 3*a*b_s^2 - a)*x^(-b_m^3 + 3*b_m^2*b_s - 3*b_m*b_s^2 + b_s^3 + b_m)*log(x)
sage: ex.subs({(b_m + (b_s-b_m)^3).expand(): b_m})
-(3*a*b_m^2 - 6*a*b_m*b_s + 3*a*b_s^2 - a)*x^b_m*log(x)