How can I do if one Numbers is irrational?

5 ビュー (過去 30 日間)
yogan sganzerla
yogan sganzerla 2015 年 6 月 27 日
コメント済み: Steven Lord 2015 年 6 月 29 日
Hello Everybody,
I have one problem, I to do if one number is irrational or rational.
For exemplo:
I have 'pi' the answer is 'irrational'
But If I have '2345/1000' it's a 'rational'
Please Help me!
  4 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 28 日
What is the input form?
Steven Lord
Steven Lord 2015 年 6 月 29 日
Every finite double precision number you can represent in MATLAB is rational. [If you wanted to consider Inf as 1/0, -Inf as -1/0, and NaN as 0/0 and stretch the definition of rational not to exclude 0 denominators, then you could call them "rational" as well.] This includes the double precision number returned by the MATLAB function PI, which is an approximation to the ratio of a circle's circumference and its diameter.
If you had a symbolic object that you constructed WITHOUT first approximating the quantity to test as a double ... then it's still an unsolved problem, as the cyclist noted.

サインインしてコメントする。

回答 (1 件)

the cyclist
the cyclist 2015 年 6 月 28 日
If you find such a program, enter pi * e and tell us if it is rational or irrational. You will be famous. (See, e.g., List of unsolved problems in mathematics.)
(I believe that determining whether a number is rational or irrational is an "NP-hard" problem.)
  2 件のコメント
yogan sganzerla
yogan sganzerla 2015 年 6 月 28 日
Ow!
But My teacher asked to me.....Because will fall in the text!
Walter Roberson
Walter Roberson 2015 年 6 月 28 日
You need to answer the question about what the form of the input is. For example. For example do you need to be able to say that sqrt(4) is rational but sqrt(5) is irrational? How about
5^(1/2)
and
5^-.5
? And how about
sin(pi/6)
?

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by