How can I do if one Numbers is irrational?

5 visualizaciones (últimos 30 días)
yogan sganzerla
yogan sganzerla el 27 de Jun. de 2015
Comentada: Steven Lord el 29 de Jun. de 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 comentarios
Walter Roberson
Walter Roberson el 28 de Jun. de 2015
What is the input form?
Steven Lord
Steven Lord el 29 de Jun. de 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.

Iniciar sesión para comentar.

Respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by