patternMinor
Comparing rational numbers
Viewed 0 times
numberscomparingrational
Problem
Given $a,b,c,d \in \mathbb N$ and $b,d \notin \{0\}$,
$$
\begin{eqnarray*}
\frac a b
$$
\begin{eqnarray*}
\frac a b
- Is there a faster method to compare rational numbers than multiplying out the denominators.
Solution
My current research:
Initial attempt at some general rules
One can try to make some general rules for solving the rational comparison:
Assuming all positive $a,b,c,d$:
$$
a d) \wedge (a \le c)
\Rightarrow
\left[\frac a b q,b>q'}
$$
Sometimes you can solve this directly now, sometimes not. The pathological cases are usually in the form:
$$
\left.
\frac a b c,b>d,c\in \mathcal O(a), d \in \mathcal O(b)}
$$
Then you flip it, and result in the same thing, just with one bit less. Each application of the rules + flip reduces it by a digit/bit. AFAICT, you cannot quickly solve it, unless you apply the rules $\mathcal O(n)$ times (once for each digit/bit) in the pathological case, negating their seeming advantage.
Open problem??
I realized that this problem seems to be harder than some current open problems.
An even weaker problem is to determine:
$$ad \overset ? = bc$$
And yet weaker:
$$ad \overset ? = c$$
This is the open problem of verifying multiplication. It is weaker, because if you had a way to determine $ad \overset ?
There are well-known algorithms for multiplying n-bit numbers with
something like O(n log(n) log(log(n))) complexity. And we can't do
better than O(n) because at least we have to look at the entire
inputs. My question is: can we actually reach O(n) for a suitable
class of "nondeterministic" algorithms?
More precisely, is there an algorithm that can accept two n-bit
binary numbers "a" and "b" and a 2n-bit number "c" and tell you in
O(n) time whether "a * b = c"? If not, is there some other form of
certificate C(a,b,c) such that an algorithm can use it to test the
product in linear time? If not linear time, is the problem of
testing the product at least asymptotically easier than computing
it? Any known results along these lines would be welcome.
John.
―johnh4717
Initial attempt at some general rules
One can try to make some general rules for solving the rational comparison:
Assuming all positive $a,b,c,d$:
$$
a d) \wedge (a \le c)
\Rightarrow
\left[\frac a b q,b>q'}
$$
Sometimes you can solve this directly now, sometimes not. The pathological cases are usually in the form:
$$
\left.
\frac a b c,b>d,c\in \mathcal O(a), d \in \mathcal O(b)}
$$
Then you flip it, and result in the same thing, just with one bit less. Each application of the rules + flip reduces it by a digit/bit. AFAICT, you cannot quickly solve it, unless you apply the rules $\mathcal O(n)$ times (once for each digit/bit) in the pathological case, negating their seeming advantage.
Open problem??
I realized that this problem seems to be harder than some current open problems.
An even weaker problem is to determine:
$$ad \overset ? = bc$$
And yet weaker:
$$ad \overset ? = c$$
This is the open problem of verifying multiplication. It is weaker, because if you had a way to determine $ad \overset ?
- math.SE: How to Compare two multiplications without multiplying?
- Suppose we were allowed to preprocess $c$ as much as we wanted in polynomial time, can we solve $ab=c$ in linear time?
- Is there a linear-time nondetermistic integer multiplication algorithm? See http://compgroups.net/comp.theory/nondeterministic-linear-time-multiplication/1129399
There are well-known algorithms for multiplying n-bit numbers with
something like O(n log(n) log(log(n))) complexity. And we can't do
better than O(n) because at least we have to look at the entire
inputs. My question is: can we actually reach O(n) for a suitable
class of "nondeterministic" algorithms?
More precisely, is there an algorithm that can accept two n-bit
binary numbers "a" and "b" and a 2n-bit number "c" and tell you in
O(n) time whether "a * b = c"? If not, is there some other form of
certificate C(a,b,c) such that an algorithm can use it to test the
product in linear time? If not linear time, is the problem of
testing the product at least asymptotically easier than computing
it? Any known results along these lines would be welcome.
John.
―johnh4717
Context
StackExchange Computer Science Q#6266, answer score: 7
Revisions (0)
No revisions yet.