Simplify outputs huge result for diff symbolic expression with hyperbolic functions
显示 更早的评论
Matlab R2019 Update 3
syms x y k real;
syms f(x,y);
syms a b;
xd = -a*tanh(k*f)+b*sech(k*f);
yd = -b*tanh(k*f)-a*sech(k*f);
chid = atan2(yd, xd);
d_chid_dx = diff(chid, x);
simplify(d_chid_dx, 'Steps', 100, 'Criterion', 'preferReal')
produces result
ans(x, y) =
(((real(b*k*diff(f(x, y), x)*(tanh(k*f(x, y))^2 - 1)) - imag((b*k*sinh(k*f(x, y))*diff(f(x, y), x))/cosh(k*f(x, y))^2) + real((a*k*sinh(k*f(x, y))*diff(f(x, y), x))/cosh(k*f(x, y))^2) + imag(a*k*diff(f(x, y), x)*(tanh(k*f(x, y))^2 - 1)))/(imag(b*tanh(k*f(x, y))) - real(a*tanh(k*f(x, y))) + imag(a/cosh(k*f(x, y))) + real(b/cosh(k*f(x, y)))) - ((imag((a*k*sinh(k*f(x, y))*diff(f(x, y), x))/cosh(k*f(x, y))^2) - real(a*k*diff(f(x, y), x)*(tanh(k*f(x, y))^2 - 1)) + real((b*k*sinh(k*f(x, y))*diff(f(x, y), x))/cosh(k*f(x, y))^2) + imag(b*k*diff(f(x, y), x)*(tanh(k*f(x, y))^2 - 1)))*(imag(a*tanh(k*f(x, y))) + real(b*tanh(k*f(x, y))) - imag(b/cosh(k*f(x, y))) + real(a/cosh(k*f(x, y)))))/(imag(b*tanh(k*f(x, y))) - real(a*tanh(k*f(x, y))) + imag(a/cosh(k*f(x, y))) + real(b/cosh(k*f(x, y))))^2)*(imag(b*tanh(k*f(x, y))) - real(a*tanh(k*f(x, y))) + imag(a/cosh(k*f(x, y))) + real(b/cosh(k*f(x, y))))^2)/((imag(a*tanh(k*f(x, y))) + real(b*tanh(k*f(x, y))) - imag(b/cosh(k*f(x, y))) + real(a/cosh(k*f(x, y))))^2 + (imag(b*tanh(k*f(x, y))) - real(a*tanh(k*f(x, y))) + imag(a/cosh(k*f(x, y))) + real(b/cosh(k*f(x, y))))^2)
while calculation by hand gives
-a*k*sech(k*f(x,y))
which is correct.
I tried options for simplification (rewrite, steps, criterion) but with no luck.
Any answer will be greatly appreciated.
采纳的回答
更多回答(1 个)
Andrey Mironenko
2019-12-20
编辑:Andrey Mironenko
2019-12-20
类别
在 帮助中心 和 File Exchange 中查找有关 Phased Array System Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!