Simplify outputs huge result for diff symbolic expression with hyperbolic functions. Part 2.

This question relates to the previous one.
After the 2D-case was successfully solved I finaly end up with the 3D-case task:
syms x y z real;
syms f(x,y,z) g(x,y,z);
syms Nc(x,y,z) r(x,y,z);
syms xd_dot(x,y,z) yd_dot(x,y,z);
syms chi_d(x,y,z);
syms fx fy fz d1 real;
syms gx gy gz d2 real;
syms k A B real;
syms F G R NC;
f(x,y,z) = fx*x + fy*y + fz*z + d1;
g(x,y,z) = gx*x + gy*y + gz*z + d2;
Nc(x,y,z) = sqrt((f(x,y,z)*fx + g(x,y,z)*gx)^2 + (f(x,y,z)*fy + g(x,y,z)*gy)^2 + (f(x,y,z)*fz + g(x,y,z)*gz)^2);
r(x,y,z) = sqrt(f(x,y,z)^2 + g(x,y,z)^2);
xd_dot(x,y,z) = -(f(x,y,z)*fx + g(x,y,z)*gx)*tanh(k*r(x,y,z))/Nc(x,y,z) + A*sech(k*r(x,y,z));
yd_dot(x,y,z) = -(f(x,y,z)*fy + g(x,y,z)*gy)*tanh(k*r(x,y,z))/Nc(x,y,z) + B*sech(k*r(x,y,z));
chi_d(x,y,z) = atan2(yd_dot(x,y,z), xd_dot(x,y,z));
d_chi_d_dx = diff(chi_d(x,y,z), x);
% substitute back original functions to shorten output
d_chi_d_dx = subs(d_chi_d_dx, fx*x + fy*y + fz*z + d1, F);
d_chi_d_dx = subs(d_chi_d_dx, gx*x + gy*y + gz*z + d2, G);
d_chi_d_dx = subs(d_chi_d_dx, sqrt(F^2 + G^2), R);
d_chi_d_dx = subs(d_chi_d_dx, sqrt((F*fx + G*gx)^2 + (F*fy + G*gy)^2 + (F*fz + G*gz)^2), NC);
d_chi_d_dx = simplify(d_chi_d_dx, 'Steps', 200);
Output is sustainable but huge anyway:
((B/cosh(R*k) - (tanh(R*k)*(F*fy + G*gy))/NC)*((tanh(R*k)*(fx^2 + gx^2))/NC - (tanh(R*k)*(F*fx + G*gx)*(2*(F*fy + G*gy)*(fx*fy + gx*gy) + 2*(F*fz + G*gz)*(fx*fz + gx*gz) + 2*(F*fx + G*gx)*(fx^2 + gx^2)))/(2*NC^3) - (k*(tanh(R*k)^2 - 1)*(F*fx + G*gx)*(2*F*fx + 2*G*gx))/(2*NC*R) + (A*k*sinh(R*k)*(2*F*fx + 2*G*gx))/(2*R*cosh(R*k)^2)))/((A/cosh(R*k) - (tanh(R*k)*(F*fx + G*gx))/NC)^2 + (B/cosh(R*k) - (tanh(R*k)*(F*fy + G*gy))/NC)^2) - ((A/cosh(R*k) - (tanh(R*k)*(F*fx + G*gx))/NC)*((tanh(R*k)*(fx*fy + gx*gy))/NC - (tanh(R*k)*(F*fy + G*gy)*(2*(F*fy + G*gy)*(fx*fy + gx*gy) + 2*(F*fz + G*gz)*(fx*fz + gx*gz) + 2*(F*fx + G*gx)*(fx^2 + gx^2)))/(2*NC^3) - (k*(tanh(R*k)^2 - 1)*(2*F*fx + 2*G*gx)*(F*fy + G*gy))/(2*NC*R) + (B*k*sinh(R*k)*(2*F*fx + 2*G*gx))/(2*R*cosh(R*k)^2)))/((A/cosh(R*k) - (tanh(R*k)*(F*fx + G*gx))/NC)^2 + (B/cosh(R*k) - (tanh(R*k)*(F*fy + G*gy))/NC)^2)
There are certian parts of code that can be simplified futher:
1.
simplifyFraction((tanh(R*k)*(F*fx + G*gx)*(2*(F*fy + G*gy)*(fx*fy + gx*gy) + 2*(F*fz + G*gz)*(fx*fz + gx*gz) + 2*(F*fx + G*gx)*(fx^2 + gx^2)))/(2*NC^3));
2.
simplifyFraction((k*(tanh(R*k)^2 - 1)*(F*fx + G*gx)*(2*F*fx + 2*G*gx))/(2*NC*R));
3.
simplifyFraction((A*k*sinh(R*k)*(2*F*fx + 2*G*gx))/(2*R*cosh(R*k)^2));
4.
simplifyFraction((tanh(R*k)*(F*fy + G*gy)*(2*(F*fy + G*gy)*(fx*fy + gx*gy) + 2*(F*fz + G*gz)*(fx*fz + gx*gz) + 2*(F*fx + G*gx)*(fx^2 + gx^2)))/(2*NC^3));
5.
simplifyFraction((k*(tanh(R*k)^2 - 1)*(2*F*fx + 2*G*gx)*(F*fy + G*gy))/(2*NC*R));
But the issue is that these simpifications do not shorten output much and also should be identified manually.
Is there any way to simplify the original output more automatically?

 Accepted Answer

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!