Reputation
70,188
Next tag badge:
212/100 score
19/20 answers
Badges
6 211 298
Newest
 Enlightened
Impact
~447k people reached

Mar
16
comment Ordering function with recognition of duplicates
So, looks like you've set the goal to get the most out of this method :-). +1, of course.
Mar
16
answered Pretty way to group elements at odd and even positions
Mar
16
comment Programmatic formatting for Mathematica code - possible?
@Mr.Wizard Because the formatter is not ready. It still contains bugs, and needs a serious rewrite too. So, seeing this answer not being accepted is just another reminder for me to do this.
Mar
16
comment Retaining and reusing a one-to-one mapping from a sort
+1. This is nice. I was surprised that Szabolcs's solution was so fast, and here is another nice application of it.
Mar
15
comment Generating replacement rules programatically
You may find this subsection of my book of interest.
Mar
15
comment Time range selector à la InteractiveTradingChart
Mike Honeychurch has an interesting blog post about this.
Mar
15
awarded  Nice Answer
Mar
15
comment How to memoize a function with Options?
@Ryogi Glad I could help. Thanks for the accept.
Mar
14
comment How to memoize a function with Options?
@AlbertRetey Thanks :-). I use self-blocking from time to time, when I want to avoid tedious passing of some arguments. Basically, a function blocks itself inside its external call, then defines itself there inside Block, and then executes. This allows me to embed those arguments which don't change,right to the body of those definitions, so they can be simpler. But, as I said, here we have an extra bonus of global access to all OptionValue-s (one - arg "magical" form of them) across the execution stack, which seems pretty neat to me.
Mar
14
comment How to memoize a function with Options?
@AlbertRetey But this is the first problem I have seen where the self-blocking technique brings more than just convenience to not pass some arguments explicitly - here also one can globally call single-argument OptionValue across the full recursive execution stack. I think this is pretty cool.
Mar
14
comment How to memoize a function with Options?
@AlbertRetey Oh, come on :-)
Mar
14
revised How to memoize a function with Options?
added 259 characters in body
Mar
14
comment How to memoize a function with Options?
@Ryogi Your biggest problem was that you did not pass options down to recursive calls, but you used the option in the memoized part as cfibon[n, k -> OptionValue[k]] = ..., so your memoized definitions were actually never used.
Mar
14
comment How to memoize a function with Options?
@AlbertRetey See my update with a meta-programming code - it takes care of that as well (as of many other things).
Mar
14
revised How to memoize a function with Options?
Added a general and more optimal metaprogramming-based solution
Mar
14
answered How to memoize a function with Options?
Mar
14
comment Unwanted hold in recursive function
The problem you have is because Thread evaluates its arguments, which leads to the picture described by @OleksandrR. This will work: F[mat_] := If[mat[[0]] === List, Thread[Unevaluated@F[mat]], f[mat]].
Mar
14
answered How to efficiently find positions of duplicates?
Mar
14
comment High quantum harmonic eigenfunctions?
You have to compute the functions on numbers of that precision. So, if you want to use Plot, you may need some tricks like N[Rationalize[x],30] instead of x in your function (or whatever precision you want to set). This will however slow things down considerably. You could also use interpolation on some fine grid, and then plot that interpolated function, I guess.
Mar
14
comment High quantum harmonic eigenfunctions?
At some point, you may actually be better off, in terms of computations, by using the WKB - approximated functions, for large values of the quantum number (where WKB works quite well).