58,167 reputation
6165258
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 8 months
seen 36 secs ago

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


1h
comment Using NDSolve to solve a PDE with a Dirac Delta function
Another possible way out here would be to approximate delta-function using some of the finite-width representations (many are well-known, all assume some limiting procedure of certain width parameter going to zero), then solve normally, then take a numerical limit of the width parameter going to zero.
1h
comment Using NDSolve to solve a PDE with a Dirac Delta function
My final advice to you: study some examples of how Delta-functions are dealt with in the context of ODEs, first in 1D, then for PDEs in higher dimensions. Then, understand your full problem, and formulate it as a ODE (or PDE). Your question in its current stage has to do more with math than Mathematica per se. Make sure you get rid of Delta-function (translate its presence to certain jumps in boundary conditions) before feeding your equations to numerical solvers.
2h
comment Using NDSolve to solve a PDE with a Dirac Delta function
It is not clear what you mean by finite width. Whenever you hit a delta-function, in any number of dimensions, it usually means that you have to divide your volume into regions, separated by the support of the delta-function, and then expect certain jumps in your function and / or derivatives (usually derivatives), so you'd need to solve separately and than match the integration constants, taking into account the contribution of the delta - function when you cross the boundary. This is as much as I can say on the general grounds.
3h
comment Using NDSolve to solve a PDE with a Dirac Delta function
You can't use Dirac delta functions in numerical PDE solving routines directly, since Dirac delta function is not a normal function, but rather a distribution (kernel of an integral operator). What one usually does is to integrate the equation involving Dirac delta function in the small vicinity of its localization point, to get the boundary conditions for the solution to the left and to the right of it. Then, you solve separately on the left and on the right, and connect the solutions using those boundary conditions. Have a look at how Dirac-delta potential is solved in Quantum Mechanics.
5h
comment Evaluating arguments of module (inside compile)
@Jansen Glad I could help, thanks for the accept. Re: book - good to know that it is useful!
19h
awarded  Great Answer
20h
comment InstallR on OS X with external R installation on 10.0.1.0
Unfortunately, this will have to wait for a bit, can't spend any time on this probably until the weekend. Are you able to fall back to using 10.0.0 for your work with RLink, for the time being?
22h
answered Where can I put my conditions?
23h
comment Recursive partitioning: Is there a better way to do this?
@Tangshutao It is not really faster, but it avoids recursion.
23h
comment Recursive partitioning: Is there a better way to do this?
@celtschk Shared variables (between the body and the condition) is a nice way to use the pattern-matcher, because it allows you to do some computation, and only then determine the fact of the match. If the condition doesn't hold, the pattern-matcher considers the rule not matched, pretending that those computations inside never happened. So, it will go on trying further rules, if the function has some more rules defined. I use this construct all the time.
23h
comment Recursive partitioning: Is there a better way to do this?
@Tangshutao That's intentional. Have a closer look at the question as formulated by the OP.
23h
comment Recursive partitioning: Is there a better way to do this?
@paw Well, it doesn't have the $RecursionLimit limitation, for one thing. The speed can't be very significantly improved simply because, for most actual use cases, the main time will be spent inside Partition, in both cases.
23h
answered Recursive partitioning: Is there a better way to do this?
1d
awarded  Explainer
1d
awarded  Good Answer
2d
comment InstallR on OS X with external R installation on 10.0.1.0
I'll have to check this. Will get back when I'm done, perhaps one or two days. We did check this before release, and it worked. So, I'll have to look closer and reproduce this. In the mean time, out of curiosity, try "RVersion"->"3.1.1" - which is what we used. If it works, please ping me here (it anyway looks like a bug, but it would be easier to localize). Thanks.
2d
comment Interpolated lookups over time from an event log
It would help if you provide some sample data, and a few sample specific queries you'd like to do, in addition to this general description. The set of sample queries would ideally cover the use cases you have in mind reasonably well. You are then more likely to get more people interested in answering.
2d
comment InstallR on OS X with external R installation on 10.0.1.0
Yes, I forgot to mention, that "RVersion" option has not yet been documented (but neither has the use of RLink with external R on Mac OS X :)).
2d
comment InstallR on OS X with external R installation on 10.0.1.0
This might be a bug (or, rather, the defaults not set quite right). What version of external R do you use? Generally, you can fix this by providing it explicitly, as indicated in the error message: try adding an explicit option "RVersion" -> "R-3.1.0", for example.
Sep
28
comment What is the recommended way to define numeric function with special cases?
@Jens Two reasons: it makes the code harder to extend (and actually, harder to read) and more error-prone when there are several branches (you would need nested If or Which), and also it tends to be somewhat slower (not by much). But, I'd agree that this is largely a matter of taste. Philosophically, the closer you are to the core language constructs, the better, and patterns / rules are certainly closer to the core than the If/Which statements, because the core of Mathematica is a term-rewriting engine.