# Working with Q instead of R

1. Jun 5, 2009

### zetafunction

the idea is, could we work only with a Q system of numbers ? i mean using only rational

the idea is that if we truncate the decimal expansion, almost any real number that appears in nature can be described by a rational number

example: $$1.345353=1345353/1000000$$

so is there a real neccesity to introduce Real numbers ? at least when we deal with practical calculations, perhaps in many other cases is just simpler to work with Q instead just R

2. Jun 5, 2009

### Santa1

But almost all my favourite numbers are irrational =(

3. Jun 5, 2009

### CRGreathouse

It's much easier to work with real numbers. They have nice properties like the supremum property. A great many problems have no solution over the rationals but have a solution over the reals.

Further, rational Diophantine equations are generally far harder than their real equivalents.

So it's less of 'have to' and more of 'want to'.

4. Jun 5, 2009

### Hurkyl

Staff Emeritus
I'm moving this to general math, because you're not discussing number theory.

I'm also going to run with your implicit assumption that we are considering an application where approximations are sufficient answers.

Yes. They're obviously important for theory. They also improve accuracy -- if you approximate things with a rational number, you are introducing an inaccuracy, and need to decrease precision (sometimes by a signficant amount) to account for it.

See wikipedia's article on numerical stability.

No; you definitely want to work with R. The question is how to represent elements of R. Or, more correctly, how to represent intervals -- remember, if we're working with approximations, we have to keep track of how good those approximations are!

And floating-point notation is the most commonly used method for representing things.

Incidentally, even when you do really want to be working with Q, such as in number theoretic calculations, it is often much better to either:
(1) Go through great lengths to reorganize the calculation so that you use only integers
(2) Do the calculations in R (and/or in a p-adic field), then convert back to Q

5. Jun 5, 2009

Quite a weak system if you cannot even have square roots, decent integrals, exponential functions, circle circumferences, trig functions... Yes for 5th grade math it is kind of useful, unless you start adding things like 99/100 + 99/101 and your representation starts exploding

6. Jun 5, 2009

### Cantab Morgan

Not necessarily. N.J. Wildberger asserts that all of trigonometry can be done with just rational numbers. His formulation is quite interesting.

By the way, why is your example sum in Q any worse than it would be in R?

7. Jun 5, 2009

### Cantab Morgan

Hurkyl, I'm sorry I'm not following this. When do we ever not approximate things with rational numbers? Every instrument that I can think of measures in rationals, not reals. Floating point itself is rational, not real.

8. Jun 5, 2009

### Hootenanny

Staff Emeritus
Suppose I asked you to solve x2=2 for x. Could you write down an exact solution using only the rationals?

9. Jun 5, 2009

### Hurkyl

Staff Emeritus
A more commonly known way to do calculations with just rational numbers is to use vector calculus (e.g. dot products and cross products).

I've glanced at this before. After glancing again, his formulation still does not seem superior, and almost surely does not live up to his advertising. Of course, it's hard to give him fair consideration after he spends all that time making a mockery of trigonometry -- e.g. his claim that your calculator uses Taylor series to compute $\sin x$ is patently false.

10. Jun 6, 2009

I though Pythagoras had disproved this a long time ago. I like to be able to take diagonals of a square.

The question is less the numbering system then the representation, all real numbers are approximated in calculation by sums of rational numbers (it called the decimal system)
But it seems you think it is better to work with the full numbers

99/100+99/101 = 19899/10100

If you add some more rational numbers to this, the denominator will grow until it contains all the prime powers that are present in the numerators. The denominator grows to be very large for negligible gains in accuracy. This is not pathological, it will happen when you approximate a series of something like an exponential function with the first terms.

Whereas the decimal notation has natural rounding build in:

99/100 + 99/101 $$\approx$$ .99+.98 = 1.97

And if you want some number of significant digits you know, when you can stop summing your series.

11. Jun 6, 2009

### Cantab Morgan

No, of course not. But I cannot write down an exact solution at all. I can only write down an approximation of $\sqrt 2$, or even write down an algorithm that will converge to it.

It only seems that way to you because you want to measure its length. And that's perfectly reasonable because length has a very desirable property: lengths add. But length isn't the only way you can compare the "heft" of line segments.

For example, you can construct squares whose sides are congruent to that diagonal segment you mentioned. And those squares will have areas, which are rational. Areas don't add in the same way that lengths do, which feels unnatural because we're so used to rulers. But taking areas as the "heft" of a line segment enjoys other interesting properties, some related to symmetries, besides being rational.

In any case, you can certainly construct the diagonal you mentioned.

I'm not trying to be dense, but I'm still not following. Your decimal numbers .99 and .98 are not irrational. You seem to be suggesting that it's undesirable to work in rational numbers, and then offer an example using rational numbers to argue the point.

12. Jun 6, 2009

### Hurkyl

Staff Emeritus
Um... you just did write down an exact solution.

That too is an exact solution.

Last edited: Jun 6, 2009
13. Jun 6, 2009

### Cantab Morgan

Well, your calculator certainly could use Taylor series to compute sines, couldn't it? (Although I suppose most today use CORDIC or something more amenable to FPGAs.) But that's just a technological detail. It's still an approximation, relying on the converging nature of some or another algorithm.

I am loathe to use the word superior, but Wildberger's formulation is different in some interesting ways. For example, if we look at some of the (nearly) modern attempts to make Euclidean geometry more rigorous, things get complicated in a hurry. (At least for poor brains like mine.) Specifically, Hilbert's Axioms spend a lot of time getting "betweenness" right. And betweenness is a really important thing. If you don't get it right, then you wind up being able to "prove" false things like a Side-Side-Angle theorem for the congruence of triangles.

Wildberger's formulation is simpler when it comes to betweenness. For example, if I have points A, B, and C on a line, and I want to relate the lengths of the resulting segments, then the equation AB + BC = AC is only true if B is between A and C. If these collinear points fall in some other order, then that equation doesn't hold. However, under Wildberger's formulation, where length isn't central, the analogous relation among A, B, and C is completely symmetric. The same equation works no matter which point is in between the other two.

14. Jun 6, 2009

I don't want to compare line segments. I am a physicist I need irrational numbers all the time. When calculating the Voltage needed over a resistor for a certain power. When calculating the shortest path in some isolator, or the amplitude of the sinusoidal voltage function function after 1 second.

[/QUOTE]
[...]
In any case, you can certainly construct the diagonal you mentioned.
[/QUOTE]
No you cannot, I like my diagonals such that I can integrate along them using the minimal enclosing sigma algebra over the Borel measures.

False this was a second point not a support of the first one. Apart from the ugly incompleteness of the rational numbers, the clumsy trigonometry and the bad integration behavior there is a contradiction in your idea, and I thought you had noticed.

Everything we measure or write down as a decimal number can only be an approximation of a real number by a rational number. So if you are suggesting that this is what we should do, then your post is pointless, since that is what everyone does with calculators. As far as I see it there are two ways to make an argument:
2) The mere concept of real numbers should be avoided.

So my first argument was against 2), and there are many more ever since we disproved Xeno. And my second was against 1), i.e. there are very undesirable properties of fraction notation, if you are dealing with approximations to real numbers.

If you want to do geometry on a grid, feel free maybe there are some uses, but especially in physics you start messing with the units by squaring, and this is very undesirable.

15. Jun 6, 2009

### Cantab Morgan

Heh heh. Did I? Or did I just write down the universally accepted shorthand notation for the equivalence class of all algorithms that converge to it? Oh, wait! That's what real numbers actually are.

Honestly, I don't think we are disagreeing. I think instead that I am just expressing myself poorly. I totally agree that reals are indispensable for theory and for many, many problems. But let me try to express myself better.

I'm coming at this discussion from the following perspective... At the end of the day, I need to know how many volts to dial up my machine to, or how many degrees I have to cool down my apparatus to. These, and all the numbers on all my gauges, are all rationals.

In the steps from setting my dials to reading my gauges, maybe there are times when I want to use irrationals, and some times where rationals will do fine all the way through. It depends on context.

Using symbolic representations for irrationals like $\sqrt 2$ are very desirable in some cases, because they can cancel out. If a human or a symbolic computer is doing some calculations, then perhaps some simplifications can be detected and exploited. The most stable calculation is the one you don't actually have to perform.

Alternatively, in a purely numerical calculation, I am (or rather my computer is) using rationals all the way through. All I'm suggesting is that this alternative case is a significant part of the work some scientists and engineers do.

16. Jun 6, 2009

### Cantab Morgan

Thank you, that really clears up where you are coming from, and now I understand much better.

I did not mean to suggest that fraction notation has compelling advantages. I'm sorry my language was poorly worded to lead you to infer that. I was using the term rational number to include decimal approximations of reals, and numbers representable numerically on a computer.

I really failed to express myself clearly on the other point. Sorry about that too! The concepts of real numbers are indispensable!

So I guess my post was pointless, but I don't think I would have used that term. I intended to respond in the spirit of the original poster's question about being simpler to do calculations numerically with rationals (but not keeping fractional notation). Perhaps the original poster meant keeping fractional notation, but I didn't interpret it that way when I read it.

17. Jun 6, 2009

### Phrak

How is a floating point number represented in, say, 32 bits of mantissa?

I believe it's of the form, for example: (.101011001... / 2^32) * 2^n, a quotient and an integer. The first decimal would be a 1, so it may not be stored.

An exception is NaN (and zero?).