Reputation
10,450
Next privilege 15,000 Rep.
Protect questions
Badges
2 24 99
Impact
~121k people reached

Mar
1
comment Improve speed in this tree - memoization won't suffice
@JasonB Currently there seems to be no way to compile this type of function. Some related posts: mathematica.stackexchange.com/questions/108121/…
Mar
1
comment Compile error with MapThread
@AlexeyGolyshev Wow, seems that I'll have a lot of answers to revise soon :D
Mar
1
comment How to speed up calculation of this equation (FindRoot)
@george2079 That's …very interesting! You should post this as a separate question!
Mar
1
comment Compile error with MapThread
@syhpphys "we can throw away the Flatten and Transpose and just replace the {n,nd,4} with {n*nd,4}" You are right, I forgot to take the code inside RandomVariate into account, thanks for pointing out, edited.
Mar
1
comment Compile error with MapThread
@syhpphys I think the 2 key points here are 1. Normalize can not be compiled so one needs to replace it with a compiled equivalent i.e. #/Sqrt@Total[#^2] & . 2. function defined with pattern-matching cannot be compiled (see the 3rd rule here?), so one needs to replace it with a pure function, which can usually be compiled if it's formed by compilable function.
Feb
29
comment Manipulating the elements of a list
@Vaggelis_Z Just for conciseness and… fun :D . Though For is slow, it's not a big deal in your case.
Feb
29
comment Trouble creating a bifurcation diagram of a trajectory
Your code is incomplete, how did you define f? And the right bracket of ListPlot is lost and there's a redundant right bracket at the end of the code. (Update: just read your previous question, you should have read the answer and comments more carefully, if you have difficulty in understanding them, simply go on asking in the comment. )
Feb
29
comment Threading over a list of lists of lists and a list of atomic expressions
" in this form only the first list is threaded over" this explanation isn't right, in this case nothing is threaded over, the output is the same as that of appendTo[list1, list2]. See this post for more information.
Feb
28
comment I was wondering why I got the different answer of the same differential equation in two different ways?
同学,请不要贴截图,贴代码文本。
Feb
26
comment Compile error with MapThread
Oh, so v10.3.1 has handled this problem in a better way :)
Feb
26
comment Compile error with MapThread
What's your version? I observed this behavior in v8.0.4 and v9.0.1. Here's the screenshot for v8.0.4: i.stack.imgur.com/tOlHH.png
Feb
26
comment Compile error with MapThread
"When you evaluate this compiled function, first 3 times and only 3 times (it's very strange!) you will see such error message" it's because the warning is suppressed then. (I understand it as a silent General::stop. ) To see a similar behavior, execute f = f[x] for 3 times.
Feb
26
comment Compile error with MapThread
Personally I also suggest you to read this answer: mathematica.stackexchange.com/a/104031/1871
Feb
26
comment Compile error with MapThread
Well, I don't think the 15 T(R1)5 = MainEvaluate[ Hold[Normalize][ T(R1)4]] and 36 T(R1)5 = MainEvaluate[ Hold[s][ T(R1)4]] lines look OK…
Feb
26
comment How to speed up calculation of this equation (FindRoot)
While it's better to post your last edit as a new question, I'm afraid the answer will disappoint you. Check these posts: mathematica.stackexchange.com/q/78768/1871 mathematica.stackexchange.com/q/31171/1871 mathematica.stackexchange.com/q/55206/1871
Feb
26
comment Why can't I replace I with HoldPattern@I?
@RolfMertig Somewhat surprisingly, Trace shows that Unevaluated actually doesn't managed to make I unevaluated in I /. (Unevaluated@I) -> a. To make the issue more obvious, just check the outputs of Unevaluated[1 + 1] -> a and Unevaluated[1 + 1]~rule~a. Not sure if it should be taken as a special behavior of Rule or there's a more general issue behind. (Maybe I should ask a new question?)
Feb
25
comment Why can't I replace I with HoldPattern@I?
@AlexeyPopkov AtomQ doesn't have a Hold* attribute so I think one need AtomQ@Unevaluated@I to check if I is an atom, the result is still True anyway.
Feb
25
comment Why can't I replace I with HoldPattern@I?
@JasonB Seems that I'm not mature enough…I swear I know about the structure of complex number in Mathematica but simply forgot about it when encountering this! You can consider writing an answer. "I assume OP has a reason for not wanting to do that", yeah, the original problem is something like … /. HoldPattern@FourierTransform[a, t, I w] :> …
Feb
24
comment How to speed up calculation of this equation (FindRoot)
@Vasilis Check my edit.
Feb
23
comment How to speed up calculation of this equation (FindRoot)
@Vasilis Just add the example into the question :) (Perhaps I won't be able to answer your new question until tomorrow though, it's midnight here)