Leonid Shifrin
  • Member for 10 years
  • Last seen this week
LetL Breaks in ParallelEvaluate
2 votes

The problem Apparently, the problem is not with Let itself, but with the fact that the symbol's definitions are not autoloaded, as you noted youself . So what happens then is that the HoldAll ...

View answer
How to map and sum a list fast?
2 votes

I don't know why I missed this question, but the Streaming` framework computes this out of the box. Unfortunately, it has to be patched in modern versions of Mathematica, so I refer to this answer for ...

View answer
positions satisfying pattern and grouped
2 votes

You can use the BoolEval function from the BoolEval package. You can load it as follows, for example: Import["https://bitbucket.org/szhorvat/booleval/raw/8e1eaf980500b5ff066b2b4bf3a61c1ad2e9c02d/...

View answer
Is there a message for functions evaluating to infinity?
Accepted answer
2 votes

Redefinition of DirectedInfinity One way would be to add a DownValue to DirectedInfinity (the final form suggested by MicahelE2): Unprotect[DirectedInfinity]; Clear[DirectedInfinity]; DirectedInfinity:...

View answer
Testing a package in Mathematica 9
2 votes

General Some time ago, I wrote a package specifically to address this issue. It is named PackageManipulations and described in this post. The package can be imported as Import["http://www....

View answer
Patterns for destructuring "Function" function arguments
2 votes

There are a few issues with your code. A minimal change to make it work would be: ClearAll[J]; J[HoldPattern[Function[vars_List /; VectorQ[vars], funs_]]] := Function @@ Evaluate /@ {vars, D[funs,...

View answer
What is the fastest way to get notebook CellGroups / Cells structure?
2 votes

Since your code has a bottleneck in NotebookGet, the only way to speed it up directly would be to speed up the latter. If your notebook exists on disk, you may try using something like this: ClearAll[...

View answer
Selecting items in a list based on multiple tests
Accepted answer
2 votes

Implementation I will show how this can be done conveniently, based on this answer. Borrowing the function select from there: ClearAll[select, where]; SetAttributes[where, HoldAll]; select[table : {...

View answer
What is wrong in my calculation with Clebsch-Gordan coefficients?
Accepted answer
2 votes

You are not using the right formula, Mathematica has nothing to do with this. When you do the summation, you have to keep the z-projection of the angular momentum fixed for the total momenta (of both ...

View answer
How to find out what files are touched when Get is called?
2 votes

This is not a complete answer, but here I will suggest a somewhat different way to extract the dependencies, than in Istvan's answer. I think my method is somewhat more economical. The idea is to load ...

View answer
Mathematica rule to express exponentials as multiplication
Accepted answer
2 votes

One possibility is to execute your entire code in some dynamic environment, where certain simplification rules are permanently or temporarily blocked. Here is the generic environment generator: ...

View answer
How can I test properties of a symbol without unwanted evaluation
Accepted answer
2 votes

As far as I can tell, in general there is no way to do what you want. One can't generally measure the memory requirements etc. for delayed definitions, because for them the creation of corresponding ...

View answer
Keep order of mulciplication in Matrix production
2 votes

One option is to define your own matrix-multiplication function, such as: ClearAll[mmult]; mmult[a_?MatrixQ, b_?MatrixQ, multF_: Times] := Outer[Inner[multF, ##, Plus] &, a, Transpose @ b, 1, ...

View answer
Mark selected sub-lists in the list they were selected from
2 votes

If you have both lists prepared already, you can use SequenceAlignment and then post-process: Flatten[ SequenceAlignment[a, b] /. {deleted_List, {}} :> Map[MapAt["-" &, #, -1] &, ...

View answer
Total elements of a list that have a common first element
2 votes

Here is a way to do this in one go: Reap[Sow @@@ Reverse[list, {2}], _, {#1, Total[#2]} &][[2]]

View answer
Using an InputField to define a function to compose with a sequence
2 votes

Here I will try to stay as close to your code and your stated goal as possible. There may be other ways to solve your problem, but for that you'd need to provide more context. I will use a somewhat ...

View answer
What is the best way for an application to provide customisation options for the user?
2 votes

I can name two ways off the top of my head: Provide global variables which the user can reset in their init.m - this is what you described. If you define these variables in your package (namespace), ...

View answer
How can I mix the behaviors of StringReplace and ReplaceAll in a single rule?
2 votes

This may not exactly answer your question, and I won't say anything really new or very different from other answerers, but, after giving it some thought, I would stress extensibility, and a clean ...

View answer
What workarounds are there to TagSetDelayed::tagpos?
Accepted answer
1 votes

I am not aware of any good workaround (if you insist on using the same syntax) - the depth-1 limitation for UpValue search is pretty restrictive. You may try something like this: ClearAll[Gate]; ...

View answer
Count elements between matching opening and closing parentheses?
1 votes

Here is a modified code from this post, where I only show the code for match, and the other (helper) functions should be taken from that post verbatim: ClearAll[match]; match[l_List] := ...

View answer
Expand an expression to only built in functions
Accepted answer
1 votes

There are several ways to do this, but here is a simple one to get you started. One thing to fix first, though, is to use delayed assignments in your variable declarations - otherwise the variables ...

View answer
Data Table Manipulation
Accepted answer
1 votes

This is what you want (if you want to stay within the syntax of the linked post): select[table, where[MemberQ[{"Alpha", "Beta"}, "ID"]]] On a large table, this will be rather slow, yes. But not much ...

View answer
1
19 20 21 22
23