How can I do if one Numbers is irrational?

5 visualizzazioni (ultimi 30 giorni)
yogan sganzerla
yogan sganzerla il 27 Giu 2015
Commentato: Steven Lord il 29 Giu 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 Commenti
Walter Roberson
Walter Roberson il 28 Giu 2015
What is the input form?
Steven Lord
Steven Lord il 29 Giu 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.

Accedi per commentare.

Risposte (1)

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

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by