60,532 reputation
6181274
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 10 months
seen 16 mins ago

Ok, an obligatory note: opinions expressed here are mine and not those of my employer.


Sep
14
revised Generating a position lookup function for an arbitrary list of integers
added 492 characters in body
Sep
14
answered Generating a position lookup function for an arbitrary list of integers
Sep
14
revised Sort strings by natural ordering
added 1654 characters in body
Sep
14
comment Sort strings by natural ordering
I just noticed the edit in question, which only confirms (to me anyway) that my point was worth making.
Sep
14
comment Sort strings by natural ordering
My comment is not about the way you or Chris formulated your answer. In a way, it is a meta-comment and describes my personal views. If it reflects anything, it is probably my own shift from stressing the (and being mostly impressed with) very concise code to see that the code can service more cases than a given case at hand, or at least is structured so that it "self-describes" its own generality / applicability to similar problems and suggests a way to be extended. As I said, this is a matter of taste, and subjective as such, so you don't have to agree with me.
Sep
14
comment How are parameters evaluated for a Plot in Manipulate
I think, this discussion is strongly relevant, even though not being specifically about Manipulate, since your real question is on how to properly localize variables in functions definitions - as the answers posted already also indicate.
Sep
14
comment Sort strings by natural ordering
While both Chris's and your solutions are concise, I feel a little uneasy with them because they use certain hidden assumptions valid only for a specific situation. This is a matter of taste, of course - in any case, I like both enough to upvote, +1.
Sep
14
comment Sort strings by natural ordering
A more concise and faster version of your method would be names[[Ordering[Characters[names]]]]
Sep
14
answered Is it possible to replicate the “magic” of OptionPatterns[] with DynamicModule's local variables?
Sep
14
comment Sort strings by natural ordering
@Maxwell The reason it works is somewhat subtle : the lists with smaller numbers just happen to be shorter, so that Mathematica canonical ordering is fully suitable for this case, since smaller lists are moved to the left, and for equal-size lists, lexicographical ordering is used. So this code elegantly uses this peculiarity.
Sep
14
comment Finding eigenvalues of a $1500\times1500$ matrix
The close vote is mine, but now that the question is specific, please disregard it.
Sep
14
answered Sort strings by natural ordering
Sep
14
comment How to get Matlab data imported with the same dimensions?
@shanusmagnus I will look at it later when I get access to Matlab, to see what the problem with my approach is. I posted it since I was solving this exact problem in a general way for my Mathematica - Matlab application in the past and tested it extensively on a number of examples. Alas, I can not tell more without testing, but since you have another answer which mostly works this should not be a serious problem for you.
Sep
14
comment How to get Matlab data imported with the same dimensions?
Actually, my code was supposed to be exactly such that the part indexing remains the same, in the same order, in Matlab and Mathematica. It worked for me this way in my application. Can not test now alas, to see for myself what's the problem if any.
Sep
14
comment How to get Matlab data imported with the same dimensions?
@shanusmagnus This is correct of you measure dimensions for one array in Matlab (size function) and another array (processed by fromMtlbToMma) by Dimensions. But if both lists are already in Mathematica and both measured with Dimensions, then I am at a loss. It may be that you have to remove the singleton trailing dimension (1), since my code assumed those are absent. If not, some small explicit self-contained example array would be nice to see, with your comments on what exactly you'd expect to get.
Sep
13
comment Generating an ordered list of pairs of elements from ordered lists
@RonaldMonson I agree with both the spirit and the attitude of your suggestions. I am also thinking myself along similar lines. Hopefully we will soon develop tools similar to what you suggest. I wish I had more time to work on them :-)
Sep
13
comment Is there a convenient/automatic way of uploading a notebook into SE?
I was also thinking about it, and this was one of the reasons I started the code formatter project, since appropriate code formatting is one of the essential parts. I have it high on my todo list to debug the current formatter and adopt it to SE format, and in general I think we are coming closer to the point when we accumulate enough tools to make such thing possible.
Sep
13
comment Generating an ordered list of pairs of elements from ordered lists
@RonaldMonson If you mean the voting, then the thing is, that since SE is a democracy (one of the few true ones), highest votes reflect the usefulness to the majority of the community. Usually truly outstanding answers make up in time. The problem with this specific one (I don't mean to say it is outstanding), is that I hit a place where mma is lacking in both built-ins or "standard libraries"(bsearch tree, iterators) and generally (no mutable data structures support, symbolic overhead), so the answer came out very long and thus unattractive.
Sep
13
comment How to get Matlab data imported with the same dimensions?
Mine arose from the necessity of 2-way exchange between Mathematica and Matlab via Matlab C API. That API asks you to provide a flat list of data and a list of dimensions according to Matlab conventions (size), and constructs an array from that data. Complementary API functions do the reverse, allowing you to extract those components. When I was doing this for multidimensional arrays, I found the recipe I posted (otherwise data did not match the indexing). I don't now remember the details alas, and right now can not check, but we can return to this later if you wish.
Sep
13
comment How to get Matlab data imported with the same dimensions?
@R.M You are probably right, although have a hunch that this disappearance of inner brackets is not on the grammar level. In any case, I was never fond of how higher dimensions are implemented in Matlab - not too consistent to my mind, and I strongly suspect they were added as an afterthought.