return the numerator and denimentor
显示 更早的评论
Hi everyone
Is there such a way to return the numerator and the denomenator of a given rational number
for example x = 1/2
I want to get n=1 , d=2
采纳的回答
更多回答(1 个)
If x is a symbolic variable, then yes
>> x=sym(1/2);
>> [n,d]=numden(x)
n =
1
d =
2
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!