Why is numden not working when there is an exponential as denominator?
Show older comments
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 Comment
Wouter Donders
on 3 May 2013
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)
Answers (0)
Categories
Find more on Common Operations 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!