How can I do if one Numbers is irrational?

5 vues (au cours des 30 derniers jours)
yogan sganzerla
yogan sganzerla le 27 Juin 2015
Commenté : Steven Lord le 29 Juin 2015
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 commentaires
Walter Roberson
Walter Roberson le 28 Juin 2015
What is the input form?
Steven Lord
Steven Lord le 29 Juin 2015
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.

Connectez-vous pour commenter.

Réponses (1)

the cyclist
the cyclist le 28 Juin 2015
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 commentaires
yogan sganzerla
yogan sganzerla le 28 Juin 2015
Ow!
But My teacher asked to me.....Because will fall in the text!
Walter Roberson
Walter Roberson le 28 Juin 2015
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)
?

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by