Arithmetic laws for rational numbers vs. real numbers

114 Views Asked by At

Are there any arithmetic laws that are always true for the set of rational numbers but not always true for the set of real numbers?

This came up because I was doing various exercises in different ways to represent real numbers on a computer (besides the IEEE 754 floating point standard) and accidentally stumbled onto a method that only produces rational numbers. I know that the result of any real number representation will terminate at the length of the data types size and thus the final result of a calculation is always rational, but in most cases the true answer is irrational and then it gets rounded and terminated into being represented as a rational number.

I was curious as to whether this weird property had any benefits that could be taken advantage of.

3

There are 3 best solutions below

2
On

Every rational number can be written as $\frac ab $ such that $a,b \in \Bbb{Z} ,b\neq 0$ with $\operatorname{gcd}(|a|,|b|)=1$.But it's not true for every real number.

1
On

Given rational non-zero $p, q$ there are non-zero integers $a,b$ where $ap = bq$. That's trivial but imagine two waves with rational period they will have a least common multiple period where they synch up on a periodic bases. A wave with a rational period and one with on odd period will match when the both start but will never synch up again.

(I dunno. That's obvious if you think about it, but it still manages to surprise me. And there's that joke in "Futurama" and the "Channel $\sqrt{2}$ News"--- It's funny if you think about it.... At least I think it is funny if you think about it....)

You talk of "using to advantage" and I think the must useful thing would be this sort of period modulo generation that can't happen with irrational values.

0
On

One of my favourites: floating-point addition is not associative or linear. This very slight failure of linearity turns out to be enough, if stacked as the last layer of a neural network, to allow the network to be trained to do nontrivial work.