Skip to main content
16 events
when toggle format what by license comment
May 6, 2013 at 16:11 comment added user76568 @bills Aaaaaaaaaand, I do VERY MUCH seriously thank you for the time you spent on my question, and the new tricks I learned from your implementation. :)
May 6, 2013 at 16:04 comment added user76568 @bills Well, obviously. Regarding that, I don't think It's TOO weird, that initially I was hoping for a step up in performance. By the way, it isn't much slower... It's same'ish-- :)
May 6, 2013 at 16:00 comment added bill s @dror - It is interesting that the functional answer is so much slower than the "simple" answer. Maybe it's because the very basic commands like Union and Table are quicker than comparatively obscure commands like Numerator and DeleteCases.
May 6, 2013 at 15:56 vote accept user76568
May 6, 2013 at 16:00
May 6, 2013 at 14:17 comment added user76568 @MarkMcClure , I guess you are right. Obviously, the performance is more than "enough" and the recovery of Stern-Brocot tree obtained by merely removing the head is quite nice. Though, I know there are many many mathematical facts that could be harnessed, for the sake of elegance, simplicity, readability (and performance!!!) among others, while still maintaining functional form.. I actually am inclined to implement it... But I don't have time now.
May 6, 2013 at 13:32 comment added Mark McClure @Dror Well, you did ask for a functional approach and this certainly provides it. Also, you never indicated that speed was your primary concern and I see no immediate reason that it should be. The primary advantage of this approach that I see is the clarity provided by its immediate connection to the mediant. By removing the DeleteCases step, for example, we essentially recover the Stern-Brocot tree.
May 6, 2013 at 9:25 comment added user76568 This implementation is slowest thus far as far as I can check
May 6, 2013 at 8:57 comment added user76568 I'll do some performance testing on this marble. Though I'm working on one my self....
May 6, 2013 at 8:46 comment added J. M.'s missing motivation Well, the OP did dismiss my proposal so glibly...
May 6, 2013 at 8:33 comment added bill s That's good, but you know, this whole approach doesn't seem any faster than the simple way!
May 6, 2013 at 8:30 history edited bill s CC BY-SA 3.0
deleted 6 characters in body
May 6, 2013 at 8:29 comment added J. M.'s missing motivation med[v_List] := Total[Numerator[v]]/Total[Denominator[v]] is a bit more compact.
May 6, 2013 at 8:23 history edited bill s CC BY-SA 3.0
deleted 3 characters in body
May 6, 2013 at 8:07 history edited bill s CC BY-SA 3.0
deleted 110 characters in body
May 6, 2013 at 8:02 history edited bill s CC BY-SA 3.0
added 69 characters in body
May 6, 2013 at 7:52 history answered bill s CC BY-SA 3.0