Reputation
52,912
Next tag badge:
100/100 score
20/20 answers
Badges
2 82 210
Impact
~696k people reached

Mar
24
comment Flatten nested lists
@ShutaoTang Yes, but your Slot based approach wouldn't work with my lis2. Anyway, at this point the OP certainly has a lot of methods to choose from...
Mar
24
comment Flatten nested lists
@Mr.Wizard Yes, the bottom-up approach can only work if the leafs are atomic - I guess maybe one could ensure that using Block if the entries are at least named by symbols that can be blocked.
Mar
24
comment Flatten nested lists
@Mr.Wizard Oh, I know what happened: I was on MMA version 8, and tested my lis2 with your method. It errored out, but now I see it works in version 10. In version 8, your answer doesn't even work with the original lis... It's because MapAt in version 8 doesn't seem to accept position specification All. That change isn't mentioned in the version-10 documentation.
Mar
23
comment Flatten nested lists
If anyone looks at the edit history, they will get dizzy... I could still annoy you with this example, though: lis = {a, {{{b}, {c, d, e}}, {{f}, {g, h, i}, {x}}}, b}; where I added an {x} together with the {f}. Your first approach works, the second still doesn't.
Mar
23
comment Flatten nested lists
Same comment here as for @Mr.Wizard.
Mar
23
comment Flatten nested lists
This works for the example, but not for lis = {a, {{{b}, {c, d, e}}, {{f}, {g, h, i}}}, b}. I upvoted anyway, since the question doesn't specify what generalizations are desirable.
Mar
23
comment Flatten nested lists
Your last one is probably a quote from the pirate in Asterix&Obelix, right? But it doesn't work on lis = {a, {{{b}, {c, d, e}}, {{f}, {g, h, i}}}, b}.
Mar
23
comment Collecting and simplifying polynomials
You can solve this by using my answer to How to keep Collect[] result in order?. I think this is a duplicate. Also, the other answers in the linked question, using PolynomialForm, don't seem to work for this example. But I tried my approach, and it does work.
Mar
22
comment Block anti-diagonalize a square matrix?
One would first have to investigate what constitutes a "best anti-diagonal form" as stated in the question. Then one would have to check whether it is unique in some sense to be defined. Without that knowledge, it's not at the level of a Mathematica question, but a math question.
Mar
22
comment How can I create a shortcut for a command in Mathematica?
Maybe the edited answer will help.
Mar
22
comment Using Mathematica to confirm Bernoulli's inequality
@Dr.WolfgangHintze I agree, it'a a matter of taste. But before you posted your answer, someone else also posted an inductive proof. That person then deleted the answer soon after. It was probably not up long enough for you to notice it, but that prompted me to look for an alternative proof.
Mar
22
comment Block anti-diagonalize a square matrix?
Of course, one could say that any matrix is itself block-anti-diagonal if we allow the single block to be the entire matrix. So I guess what I'm saying is that the problem isn't well-defined.
Mar
22
comment Block anti-diagonalize a square matrix?
It would be OK to keep this open if a more detailed explanation of the necessary mathematical background or goals were provided, since Mathematica doesn't seem to have this functionality.
Mar
22
comment Block anti-diagonalize a square matrix?
I'm voting to close this question as off-topic because it seems to be based on a mathematical misconception.
Mar
22
comment Block anti-diagonalize a square matrix?
No, the unit matrix will never have a block-anti-diagonal form that can be achieved by a similarity transformation. For other matrices, my determinant argument is one way of disproving the claim.
Mar
22
comment Polar color coding for complex function plots?
Closely related, and possibly a duplicate in the absence of further information: Compiling ColorFunction for faster complex phase-amplitude plots
Mar
22
comment Very slow mathematica finite differences
You can replace the arrays by larger ones that store the information for each time step. E.g., replace Σ[[_]] by Σ[[tcount, _]] everywhere. This means you also have to start with tcount=1 and initialize Σ = Table[0., {100}, {ngrid}]. Here, 100 is a static size that should be chosen to be large enough for your number of time steps (which is variable). In the output, replace Σ by Σ[[;; tcounter - 1]]. For more information, you should also read How to compile effectively?, which goes beyond the scope of this question.
Mar
22
comment Random walk using Module
You just have to search the docs. In particular, see here under Aplications, and here.
Mar
21
comment How can I create a 3D representation of an object with known coordinates and adjacency table in mathematica?
@SjoerdC.deVries The question looks OK now. When I saw it, all it had was a link to an external PDF. That's never OK for an acceptable question.
Mar
21
comment Cauchy Principal Value integral- no result is obtained
When using Integrate, it's best to keep the integrand as simple as possible. By defining y before Integrate, you make it unnecessarily complicated. Do Clear[y] before integrating. Then define y afterwards.