# Help with simplifying a complex symbolic expression

25 views (last 30 days)
Lu Zhao on 26 Mar 2021
Commented: Lu Zhao on 29 Mar 2021
There is a symbolic expression, and one of the variable "U_j0" can be cancled out.
But when I use "simplify()" command, "U_j0" is still in the expression. Can anyone help me out to further simplify the expression below?
syms dIm Im dKm Km alpha1 omega1 S U1 delta c1 m
syms omega Omega R0 R Uinf U_j0
% The following is the symbolic expression waiting to be simplified. ^ O ^
% Thank you!
term1=((2*log(-(U_j0*(alpha1 - alpha1*c1 + S*delta*m))/delta)*(S^2*m^2 + 2*S*alpha1*c1*m - 2*S*alpha1*m - alpha1^2*c1^2 + 2*alpha1^2*c1 - alpha1^2))/(m^2*(alpha1 + S*m - alpha1*c1)^2) - (log(R)*(m^2 - 2))/m^2 + (Im*alpha1^2*((R*dIm*delta*((2*S*(S*m - alpha1 + alpha1*c1))/(m*(alpha1 + S*m - alpha1*c1)^2) - (log(-R*(delta - 1))*(m^2 - 2))/m^2 + (2*log(-(U_j0*alpha1*(c1 - 1)*(delta - 1))/delta)*(S^2*m^2 + 2*S*alpha1*c1*m - 2*S*alpha1*m - alpha1^2*c1^2 + 2*alpha1^2*c1 - alpha1^2))/(m^2*(alpha1 + S*m - alpha1*c1)^2)))/(Im*alpha1) - (R^2*delta^2*((U_j0*alpha1*(c1 - 1))/(R^2*delta*(delta - 1)) + (S*U_j0*m*((2*S*(S*m - alpha1 + alpha1*c1))/(m*(alpha1 + S*m - alpha1*c1)^2) - (log(-R*(delta - 1))*(m^2 - 2))/m^2 + (2*log(-(U_j0*alpha1*(c1 - 1)*(delta - 1))/delta)* (S^2*m^2 + 2*S*alpha1*c1*m - 2*S*alpha1*m - alpha1^2*c1^2 + 2*alpha1^2*c1 - alpha1^2))/(m^2*(alpha1 + S*m - alpha1*c1)^2)))/(R^2*delta*(delta - 1))))/(U_j0*alpha1^2*(c1 - 1)))*(c1 - 1)*(delta - 1))/(delta*(Im*S*m - R*alpha1*dIm + R*alpha1*c1*dIm + R*alpha1*dIm*delta - R*alpha1*c1*dIm*delta)) + (2*S*alpha1*(c1 - 1)*(delta - 1)*(S*m - alpha1 + alpha1*c1))/(m*(alpha1 + S*m - alpha1*c1)^2*(alpha1 - alpha1*c1 + S*delta*m)));
I tried to combine "log()" terms by hand and simplified the above expression to get a new one shown below (cancel variable "U_j0") , but the expression I got is not correct. I wondered anyone could help me to use MATLAB program to simplify this expression and cancel variable "U_j0"?

Paul on 26 Mar 2021
This code eliminates U_j0:
[num,den]=numden(term1);
newnum = combine(num,'log','IgnoreAnalyticConstraints',true);
newterm1 = newnum/den;
Lu Zhao on 29 Mar 2021
That is great! I learned a lot from it. Than you. I really appreciate it. : D