9,006 reputation
1640
bio website
location
age
visits member for 2 years, 3 months
seen 3 hours ago

Jan
18
comment How to minmize the memory problem in a compile function for a given code?
Why do you say "the compile function is not working"? For me it's the NDSolve that needs a lot of memory, so I stopped it to keep my computer operable. My impression is that you did try some optimizations in a quite arbitrary way, none of them seems to give any speedup, let alone safes you memory (which seems the main problem). Replacing all the Parallel functions with their sequential versions and using Compile with no options at all leaves the runtime exactly the same. You also might want to explain why you are using those options for NDSolve, can you explain why you chose them?
Dec
27
comment How to integrate functions of linearly interpolated data?
@halirutan: no problem, I didn't remember it was an open question until Alexey answered :-).
Dec
27
comment How to integrate functions of linearly interpolated data?
@AlexeyPopkov: thanks, that's useful. Actually it is where one could expect to find it, I obviously just didn't try hard enough...
Dec
27
answered Scheduled tasks not preserving order with Dynamic?
Dec
27
awarded  Nice Answer
Dec
23
answered Refering to global variables inside modules
Dec
17
comment Plotting heat equation in a Manipulate expression
@Ajasja: ... here are two examples with a more appropriate usage of Module which show what I am trying to say: Manipulate[Module[{z}, z = a^2; z], {a, 0, 2}] vs. Module[{y}, Manipulate[y = a^2; y, {a, 0, 2}]]. Interestingly by checking with Names["Global*"]` I found that Manipulate itself does leave behind a mess of new symbols for its own local variables, which I honestly do consider a "dirty" job, especially considering that DynamicModule doesn't show the problem...
Dec
17
comment Plotting heat equation in a Manipulate expression
@Ajasja: while it ist true that Module does create a lot of symbols for the local variables if used inside a Manipulate these usually are temporary and removed after the Module finishes (with the usual exceptions as in your examples). A Manipulate inside a Module will, on the other hand, only generate symbols for the local variables once, but these will always leak if used in the Manipulate and remain existing -- which I think is potentially a larger problem...
Dec
13
comment Detecting a collision in n-body simulation with NDSolve
@Silvia: and for n bodies there would be a possibility for an m-body collision with 2<=m<=n. Of course the code I've shown doesn't cover that, but I think it would just mean to provide more sophisticated code for the event-action to cover such cases...
Dec
13
comment Detecting a collision in n-body simulation with NDSolve
@shrx: AFAIK it isn't possible to see the message in the WhenEvent, but I may well be wrong. Even if it would be possible I think waiting for the message to appear wouldn't be a very efficient solution as it might take a lot of very small steps before NDSolve stops. What you could try is to check the step size yourself and react to a small step size in the WhenEvent, probably only then checking the distances as well. Maybe you should add it as a requirement to your question that you explicitly want to avoid the calculation of the euclidian distance.
Dec
12
revised Detecting a collision in n-body simulation with NDSolve
added 464 characters in body
Dec
12
answered Detecting a collision in n-body simulation with NDSolve
Dec
12
comment Detecting a collision in n-body simulation with NDSolve
I think you just can't use the message that NDSolve issues as an event trigger. Presumably the message is only generated after the integration has stopped for that reason. What I'd do is to check for the actual minimal distance between all bodies and if that is smaller than their extents that means collision. This will also be faster as it avoids the very small step sizes which lead to the message...
Dec
7
comment Trouble avoiding computation in DynamicModule when input field is not defined
I agree that this is a duplicate, but the issue seems to be the wrong use of Dynamic, the code will do what is expected when using Dynamic[foo[symbol]] instead of foo[Dynamic[symbol]] and that isn't explained in the linked duplicate question IMO. The best answer I could find seems to be John Fultz's to this question, which I think would be a better duplicate link, but probably someone knows a good candidate on ME...
Dec
7
comment Run kernel script in cygwin without window popping up
Actually I think this is not a duplicate, at least not for the question linked: he is trying to run a Kernel from C++ code and that isn't covered by the linked question. It could be argued that this isn't a Mathematica specific question as any command line programm run in a cygwin terminal would have the same issues. @jorgen: I think you should ask that at a cygwin or c++ specific forum, or do you have any indication that this ONLY happens for a Mathematica kernel but not for other command line programs?
Nov
29
answered List comprehension in Mathematica
Nov
28
revised Nested NDSolve with WhenEvent: setting up new equations and discarding old ones
added two additional approaches, one using a loop the other using recurrence
Nov
28
comment Creating a custom context with a Hold construct
No, you need Verbatim for that one (and everything that is used to make up patterns): testit_ /. Verbatim[Pattern][a_, _] :> a. When a combination of both is needed things become a little hard to read :-)
Nov
28
comment Creating a custom context with a Hold construct
Sorry, have had two very busy days. I tried to explain more clearly what I meant (although I'm not confident that I was successful). The use of Context seems to be a really interesting feature, I'll certainly play with that. It seems to be the key to interesting solutions for these kind of problems...
Nov
28
revised Creating a custom context with a Hold construct
tried to explain better the problem of invisibility of existing symbol definitions