11,024 reputation
12152
bio website
location
age 28
visits member for 2 years, 2 months
seen Jul 18 at 17:03

Jan
28
answered Frequency of elements in a list
Jan
28
answered Creating Recursive Sequences
Jan
27
comment LetL and Module efficiency
@LeonidShifrin You seem to be very biased. If I was going to do an "honest" comparison in that respect, the let'macro should really have it's runtime added making it the worst possible scoping construct. It's alright because it does it's expansion at define time, I just added a better example of how to expand the scopes at run-time, in fact I would argue the optimal scoping structure you can use during the definition. Also I would add comparing Apples and oranges seems fine when you are talking about differneces in fruits. Here scoping levels.
Jan
27
comment LetL and Module efficiency
The topic of this question was efficiency in scoping. And the most efficient scoping in the example case arguably is as shown to scope outside the definition. While true that this is somewhat differently themed then just using better nested scopes, it's not outside the theme of the question.
Jan
27
comment LetL and Module efficiency
@LeonidShifrin My own scoping macro currently does this optimization, so I don't think it's that unfair to compare performance. It's really the best way to order the scopes if you are doing definition time optimization, which is also what is typically done in the letmacro. And "completely different area" is kind of rough remembering that it's just a case of moving the lhs two levels into the definition, other then that the code is practically identical.
Jan
27
answered LetL and Module efficiency
Jan
25
awarded  Nice Answer
Jan
25
comment Why is Mathematica's expansion of expressions with square roots so slow?
@AlbertRetey At the time of writing of this answer OP did not include the information needed to realize that he was in fact comparing two analytically solutions. As such both me and belisarius belived it was a case of comparing numerical to analytical timings, which is often the case when people observer unexpected slow code.
Jan
25
comment Why is Mathematica's expansion of expressions with square roots so slow?
@AlbertRetey I updated the timing. And indeed, I would expect that Maple is just doing it iteratively while Mathematica evaluates each possible sequence. I expect it's a case where complexity analysis dictates the suboptimal algorithm for this case. I think the Maple style expansion will worst case get 5^O(n) terms that can then be collected, while Mathematica already has all the trival terms collected, and therefore only evaluates around 5000 terms. However, since the iterative approach can quite effectively reduce the number of terms, it's nowhere near the upper limit for this example.
Jan
25
revised Why is Mathematica's expansion of expressions with square roots so slow?
added 3 characters in body
Jan
25
revised Why is Mathematica's expansion of expressions with square roots so slow?
deleted 1 characters in body
Jan
25
comment Why is Mathematica's expansion of expressions with square roots so slow?
@AlbertRetey I wouldn't call it a workaround. They are two different methods of achieving the same result, and in this case one is faster. I would wonder however if anyone knows if there are arguments for using Mathematica's rather than iterating. Perhaps it's due to elements of Expand's other functionality.
Jan
25
revised Why is Mathematica's expansion of expressions with square roots so slow?
added 2 characters in body
Jan
25
revised Why is Mathematica's expansion of expressions with square roots so slow?
added 285 characters in body
Jan
25
revised Why is Mathematica's expansion of expressions with square roots so slow?
added 397 characters in body
Jan
25
answered Why is Mathematica's expansion of expressions with square roots so slow?
Jan
25
revised What are the most common pitfalls awaiting new users?
loops are plentyfold in Mathematica, and should not be avoided, it's the procedual side-effect geared loops that should be avoided.
Jan
24
comment Bit Operations — Force Binary Bit Representation
@Stefan "...turns ones into zeros.." is never falsified, and it does provide a 1's complement as is shown in Szabolcs example 0101->1010. What would you expect 0101 to be turned into? I think you're confusion is with what those steams of bits are interpreted as when you convert them back into numbers. Did you look at the wiki page both me and Szabolcs linked to?
Jan
24
comment Can my color function be written more simply?
@Mr.Wizard Feel free to add it here if you'd like.
Jan
24
comment Can my color function be written more simply?
@Mr.Wizard Indeed, you could do that, but strictly speaking it wouldn't be the same, since the current implementation allows you to change the colors at any point while the faster version would have you redefine the function to change colors. For a fun illustration of the difference, try using ColorFunction -> ((colors = RotateRight@colors; cf[##]) &). :)