Why is numden not working when there is an exponential as denominator?

3 次查看(过去 30 天)
Hey,
I am trying to separate the nominator and denominator with the matlab function numden(). This is the code
syms x y
f = (x^3*y+5*x^2*y)/(exp(x^2+3*y^4));
fx=diff(f,x);
fx = simplify(fx)
[fx_n,fx_d]=numden(fx)
The problem is that it gives as output
fx_n = (x*y*(- 2*x^3 - 10*x^2 + 3*x + 10))/exp(x^2 + 3*y^4)
fx_d = 1
While I want it to be like
fx_n = (x*y*(- 2*x^3 - 10*x^2 + 3*x + 10))
fx_d = exp(x^2 + 3*y^4)
If exp is changed to anything else, like cos, sin, tan or something else it is working but not for exp.
Thank you for your help.
Regards
  1 个评论
Wouter Donders
Wouter Donders 2013-5-3
Not sure what causes this behaviour other than that Matlab parses the divison by the exponent as a multiplication by its reciprocal. A workaround is by not using the exp function itself but it's definition:
syms x y e
f = (x^3*y+5*x^2*y)/(e^(x^2+3*y^4));
fx=diff(f,x);
fx = simplify(fx)
[fx_n,fx_d]=numden(fx)
This will yield:
fx_n = x*y*(- 2*log(e)*x^3 - 10*log(e)*x^2 + 3*x + 10)
fx_d = e^(x^2)*e^(3*y^4)

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by