Why is numden function returning values with fractions?
Show older comments
I'm trying to simplify an expression. I wrote:
>> syms r a b c d x y;
A = tanh(a/4)*sqrt((cosh(r)-cosh(a/2))/(cosh(r)+cosh(a/2)));
B = tanh(b/4)*sqrt((cosh(r)-cosh(b/2))/(cosh(r)+cosh(b/2)));
C = tanh(c/4)*sqrt((cosh(r)-cosh(c/2))/(cosh(r)+cosh(c/2)));
D = tanh(d/4)*sqrt((cosh(r)-cosh(d/2))/(cosh(r)+cosh(d/2)));
sigma1 = A + B + C + D;
sigma2 = A*B + A*C + A*D + B*C + B*D + C*D;
sigma3 = A*B*C + A*B*D + A*C*D + B*C*D;
sigma4 = A*B*C*D;
tA4_1 = (sigma1 - sigma3) / (1 + sigma4 - sigma2);
tA4_2 = subs(tA4_1, cosh(r), x/y);
[n1, d1] = numden(expand(tA4_2))
The result that I got was
n1 =
tanh(a/4)*tanh(b/4)*tanh(c/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2) - tanh(b/4)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2) - tanh(c/4)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2) - tanh(d/4)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) - tanh(a/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2) + tanh(a/4)*tanh(b/4)*tanh(d/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) + tanh(a/4)*tanh(c/4)*tanh(d/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) + tanh(b/4)*tanh(c/4)*tanh(d/4)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2)
d1 =
tanh(a/4)*tanh(b/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2) + tanh(a/4)*tanh(c/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2) + tanh(a/4)*tanh(d/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) + tanh(b/4)*tanh(c/4)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2) + tanh(b/4)*tanh(d/4)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) + tanh(c/4)*tanh(d/4)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) - tanh(a/4)*tanh(b/4)*tanh(c/4)*tanh(d/4)*((x - y*cosh(a/2))/(x + y*cosh(a/2)))^(1/2)*((x - y*cosh(b/2))/(x + y*cosh(b/2)))^(1/2)*((x - y*cosh(c/2))/(x + y*cosh(c/2)))^(1/2)*((x - y*cosh(d/2))/(x + y*cosh(d/2)))^(1/2) - 1
This still contains fractions in the numerator and the denominator, but my impression was that numden was supposed to give the numerator and denominator of a simplified fraction. Did I do something wrong, or is the numden commnand not designed to do this?
Thanks.
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!