56,877 reputation
5160252
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 37
visits member for 2 years, 7 months
seen 41 mins ago

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


Dec
18
comment Any built-in function to generate successive sublists from a list?
Ok, since you posted this, I am liberated from doing that (I gave it in comments to the question), and can happily upvote : +1.
Dec
18
comment Any built-in function to generate successive sublists from a list?
@rm-rf Somehow I did not expect so much excitement about this topic, so many answers. I could as well post it indeed. Perhaps I will. But my solution suffers from the same flaw as others.
Dec
18
comment Any built-in function to generate successive sublists from a list?
@rcollyer Be careful with MapAt though.
Dec
18
comment Any built-in function to generate successive sublists from a list?
+1. But the real clean solution here is to use linked lists, since all of the suggested ones have quadratic complexity in the length of the list.
Dec
18
comment Any built-in function to generate successive sublists from a list?
How about something like Rest@FoldList[Append, {}, {a, b, c, d}]? More succinctly, FoldList[Append,{First@#},Rest[#]]&[{a,b,c,d}]
Dec
17
comment Break[] inside ColorFunction
This also has to do with the anonymous functions, since Plot[x, {x, 0, 1}, ColorFunction -> (Function[c, ColorData["Rainbow"][f[c]]])] works fine. Perhaps, @Rojo is right, and it tries some destructuring of the function and isn't careful enough about it.
Dec
17
comment Syntax highlighting for your own functions
@AndreasLauschke Thanks:) But it actually has to be rewritten. It has a number of design issues which I hope to address soon enough. In many places, the code is pretty ugly to my taste, also.
Dec
17
awarded  pattern-matching
Dec
16
comment Different behaviour of ValueQ inside and outside of a loop
Somewhat related question
Dec
14
comment Sorting function for non commuting bosons
@Karan Good that you managed. In general, such problems are expected. If you want to make it rather general-purpose, you have to add more rules.
Dec
14
comment Sorting function for non commuting bosons
@Karan I don't have much time now, but Times sometimes evaluates, so you often need HoldPattern. I also did not include Times in the rule, that's why your input does not evaluate.
Dec
14
comment Reloading package after accidental Remove[] of symbol
Note that reloading a package in such a case is a necessary but often not sufficient measure in such situations. In particular, if there are symbols defined in Mathematica session (in other packages that use that one or otherwise) which refer to the symbol you removed, you have to reload those packages / definitions as well. The problem is made worse by the fact that there are no warnings, neither when you remove the symbol, nor later when you call those functions. Their definitions simply become invalid. And the re-introduction of the symbol into Mathematica session does not help it.
Dec
14
comment Sorting function for non commuting bosons
@Karan See the edited version. Try to understand the logic here, this part with c-numbers was not hard at all.
Dec
14
revised Sorting function for non commuting bosons
Added c-number treatment
Dec
13
comment Sorting function for non commuting bosons
@Jens Thanks, edited.
Dec
13
revised Sorting function for non commuting bosons
Modified to better show the unit operator
Dec
13
comment Sorting function for non commuting bosons
@Karan Works for me too: expand[NonCommutativeMultiply[BosonA["a"], BosonA["a"], BosonC["a"], BosonC["a"]]] results in 2 NonCommutativeMultiply[] + 4 Boson[True, "a"] ** Boson[False, "a"] + (Boson[True, "a"])^2 ** Boson[False, "a"]^2. Make sure you use the corrected definitions for the boson operator formatting: I edited your post, since you had f instead of If in one place.
Dec
13
comment Sorting function for non commuting bosons
@Jens Thanks for testing and an upvote, good to know that it works. It basically does what we usually do by hand. But, if you ask me, it is esier to switch to path integrals, no operators - no problems :) (I am joking - operator formalism certainly has its merits)
Dec
13
comment Sorting function for non commuting bosons
@Jens No, I edited already after your comment on this, so you could not have used the edited version when you tried.
Dec
13
revised Sorting function for non commuting bosons
Corrected a bug in definitions for boson operator formatting