>A strategy to approach this problem would be to make an >iteration start at 0 order, test 0 order values, and then >test 1 order values, etc. I think this is probably not the most efficient way to figure out what the simplest number is. Say the fractions were 3/10000 and 1/10000, then it seems like the simplest strictly contained is 2/10000, but it would take this procedure a very long time to find it, since (if I understand you correctly) we’d be testing lots and lots of values for, say the 12th complexity (all permutations of two factors of 12 between two given rationals), and when it got to larger numbers, we could be in for serious amounts of computation. I have another idea, although I'm not sure if it's more efficient or not yet. (The problem I'm talking about primarily here is to find the simplest fraction contained in an interval, although I haven't given any real thought yet to the other question, which is how to find the simplest subinterval) So, we're given a general interval. But the simplest fraction in an interval is the simplest fraction in any subintervals, and the simplest fraction in an interval is the negation of the simplest fraction in its negation. So...for negative groups, we can find the simplest in the negation of that group and negate it, and for groups with zero, we can find the simplest in the interval on the side of zero that includes its negation and negate the result if the larger of the intervals was positive. (You said the first two parts of this, I think). So, now it seems like the problem is, given a positive interval, find the simplest fraction in that interval. Well, the simplest fraction has to have a denominator at most as large as the largest denominator of one of its smaller endpoint (since if this weren't true, and the simplest fraction was greater with a larger denominator, then it would also have a larger numerator, which is a contradiction.) So, we know that we're just searching numerators less than or equal to a certain number. There is a nice structure, though, that is just these fractions with denominators less than or equal to some number for an interval between 0 and 1, a Farey Series. A simple search turned up the Stern Brocot Tree(http://mathworld.wolfram.com/Stern-BrocotTree.html), which seems to suit our purposes rather nicely. It generates all the rationals, and the nth level has a complexity of at least n, which is good (since the complexity of the number we're looking for has to be less than the product of the numerator and the denominator of the lower bound of the interval), so it seems like this is headed for, at worst, a linear-type efficiency. Drawing a few trees and staring at them for awhile unravels a few intrinsic properties that seem like they would be useful. (It also yielded an easier way to draw the trees :) ) The definition listed at the link is a little bit unclear, because it defines each node by its descendants (i.e., each node is the median of its direct descendants). Getting right to the point, it seems pretty clear by this definition that if we picked two arbitrary nodes in this tree, their shared ancestor is guaranteed to be in the interval, but the next node up from that (and successive ones) would have to be outside the interval. I also suspect that the complexity of ancestors is always less than that of descendants, since it seems that medians always have lower complexity. Now, it seems like each node is the median of the one above it it's first right and left ancestors. Meaning, the first node that you arrive at when traversing up to the right, and the first node you arrive at when traversing up to the left. I think this makes sense in general too, since (looking at a Farey Series to see that new nodes are generated as the median of the two closest ancestors), the two closest ancestors must be the first left and right ancestors. I think this is because the node is bounded above by all right ancestors and below by all left ancestors, and the closest right and left ancestors must be the first ones. Anyways, that's the way I reason it, I may be wrong. In any event, this sort of relation (generating new nodes from the top, instead of from the bottom, which is ever so much more useful) seems to guarentee that the complexity will increase with as we go down a path in the tree. Now that we have all these lovely fractions, and a seemingly approachable way to create them, how do we answer the question? I'm not sure about the best way to do this, but this is an idea: By the way we made the tree, it seems like we have a way to get one farther up the tree whose value we know is between that of two arbitrary nodes. But it seems like this should happen if the two nodes are both descendants of a common node, one bounding it bounded above and one bounded below. But we know that the first shared ancestor would have this quality, since it would be below the higher one and above the higher one (it being the root of a tree containing the higher node down the left branch (so the root is a left-ancestor -> is less than the higher node) and containing the lower node down the right branch (so the root is a right-ancestor -> is greater than the lower node)). So we can get a simpler one, and I think that this shared ancestor is also the simplest one we can find. Because if we go furter up the tree, it'll either be a right ancestor of both nodes (right ancestor of the higher node -> greater than the higher node's value) or a left ancestor of both nodes (left ancestor of the lower node -> lower than the lower node's value). In terms of efficiency, I think this should be pretty good, something like linear, since when we traverse down the node the denominator lowers by at least one each time we go to a descendant, so it'll take at most as many down-traversals as the denominator of the lower bound of the interval, and in most cases it should be much less than that. Also, if we keep track of the nodes of the last right and left traversals we made going down the tree (which I suspect we'll have to keep track of anyways in generating the tree by the second method mentioned, from the root), we'll just need to traverse down to each number and take the last left traversal of the higher one and the last right traversal of the lower one. I think. Potential problem: intervals with very high numbers may be problematic in that they will take a long time to get that far over to the right in the tree. Potential solution: shift the interval over by "normalizing" with multiplication by some an appropriate integer. It's also possible that we could obtain a more efficient process by somehow shrinking very large intervals by division by a carefully selected integer. Maybe the simplest fraction in an interval divided by an integer should be the same as the quotient of an integer and the simplest fraction in an interval divided by that integer? Anyways, these are my thoughts so far, and what information I could glean from mathworld.wolfram.com. Apologies for confusion between nodes and their values, but I think in most cases it should be pretty clear which one I mean. I'd like to look this up somewhere more useful before really devoting some time to it as any sort of project, so...basically, I don't want anybody to do serious thinking about these things without understanding that I haven't like proven them, so don't take them as granted and spend time working with the ideas unless you're independently also sure that they're the right track to go along in solving this problem. adam
|
A Preliminary Implimentation by Adam Yavitz, 2002, Nov 11
to: