Reputation
12,381
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
20 49
Impact
~108k people reached

Jun
18
answered Why are dictionary keys reordered upon JSON import?
Jun
18
revised Extract all Values from nested Association
deleted 5 characters in body
Jun
18
comment Why are dictionary keys reordered upon JSON import?
@MichielvanMens: one more note. I think it would turn out that the code for your analysis could very well be simpler, easier to read and less error prone if you'd not convert the nested Associations into flat tables. Depending on what you are doing it might even make sense to convert the list of nested Associations into a Dataset and use the new Query functionality for your analysis, but it might need some extra learning to make good use of that...
Jun
18
comment Why are dictionary keys reordered upon JSON import?
@MichielvanMens: I have seen that question and IMHO it confirms that you are doing things wrong. If you really need that data as a plain table you should not construct it with Kubas solution but rather extract with something like I have shown in an answer to that other question -- and voila: field order doesn't play a role anymore...
Jun
18
answered Extract all Values from nested Association
Jun
18
comment Why are dictionary keys reordered upon JSON import?
@MichielvanMens: as Szabolcs has explained there is no ordering in the properties of a JavaScript object, so in the (very unlikely) case that someone puts any information into that ordering then that is an error in the data. Also from your vague description I don't see why you'd need field ordering to make correct use of that kind of data, could you show an example where this seems necessary? It certainly isn't necessary to work with the example data you gave in your question...
Jun
18
comment Why do Mathematica list indices start at 1?
I'm not in a position to put into question Dijkstra, but I'm quite confident that you can find just as many publications which argue that starting at 1 makes more sense. I think the real reason why many programming languages start to index at 0 is because C does that, but there it is more a consequence of array indexes being equivalent to pointer offsets and probably not so much a design decision. I have extensively used languages with both conventions and personally found the zero based indexing more error prone, 1<=i<=N seems to be a quite natural choice for ranges to me...
Jun
17
comment How do I make a definition/function/method as I would in Java/MATLAB/Python
I think it would not be too hard to combine parallel evaluation with an early exit strategy. If you need that, you could use a combination of ParallelSubmit and WaitNext
Jun
16
comment How do I make a definition/function/method as I would in Java/MATLAB/Python
it certainly is OK if it works for you. I personally would use a Do loop instead of For and probably localize res and (when using For) i as well. Other than that I think there is a typo (v vs. u in the definition of LHS). As Jens has mentioned there are more Mathematica-ish ways to do the same thing but I don't think that these will have strong advantages in this case...
Jun
15
answered How do I make a definition/function/method as I would in Java/MATLAB/Python
Jun
15
revised How to exclusively match in the numerator?
added 379 characters in body
Jun
12
answered How to exclusively match in the numerator?
Jun
12
comment How do I make a definition/function/method as I would in Java/MATLAB/Python
I'm wondering how you define something like Confirm[wavefunction[x_, n_], potential[x_], energy[n_]] in any of the languages you mentioned? It's hard to answer your question with the information you gave, could you provide a minimal example which will show your problem? My guess is that you did make definitions for wavefunction,potential and energy and because these are evaluated the definition of Confirm can never match as the results of the former will not have the Heads you are trying to match anymore...
Jun
12
comment FindMinimum and WhenEvent
Usually all the functions that do some math (be it symbolic or numeric) like functions better which are "mathematical" compared to "programmatical" stuff. So you sometimes get better results faster when you use e.g. UnitStep and similar functions than If or Which, which both are not something that can mathematically understood. I don't think it makes a difference here, at least not if you ensure evaluation only for numeric arguments, but you might try a UnitStep variant and see whether that makes a difference...
Jun
12
answered FindMinimum and WhenEvent
Jun
8
comment How to vary finite difference approximation order in `NDSolve` at boundaries
Sorry, I didn't see that you had that reference in your question. I can not answer your question about boundaries, at least not without reading through the documentation once more, which I have no time for, sorry...
Jun
8
comment How to vary finite difference approximation order in `NDSolve` at boundaries
have you seen the documentation (here)[reference.wolfram.com/language/tutorial/… which is also available in the local documentation center. I think it contains everything you might or might not want to know about the Method of Lines as used in Mathematica :-). To begin, there is the "SpatialDiscretication" option for the MethodOfLines method with which you should be able do what you want (and probably much more). The documentation has some usage examples...
Jun
8
comment What method does NDSolve use for solving PDEs?
I think you should mention that since version 10 there is also the "Finite Element" method, which can solve equations which were not possible to solve with "Methods Of Lines" (as e.g. the mentioned Laplace eq.). Among other things, the finite element method can also be used as an alternative to the methods of lines to discretize the space-like dimensions and create a system of ODEs to solve in time...
Jun
6
comment How can I make Plot show the plot while it's computing it?
have you checked that the kernel crashes don't happen without the dynamic plots? NIntegrate is also a complicated function which might get into trouble.
Jun
6
comment Kernel Crash while using “ValuesOnGrid” method of InterpolatingFunction
my suspection is that there is some internal state behind the scenes which is not transfered correctly to the exported expression or not correctly reestablished when importing. I don't know if any of this is documented or meant to be seen by users at all.