Reputation
11,226
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
20 47
Newest
 Nice Answer
Impact
~102k people reached

19h
comment Import nested JSON file
Honestly I don't know if you will/can be faster with a more "low level" approach with large files. As applying replacements rules with the pattern matcher is at the very core of Mathematica it is implemented in a quite efficient way, but it is of course an expensive operation, so you might be able to outperform it. I'd go with the most simple approach (pattern matching) and only try to improve when I had an example where it clearly seems necessary. That would then make up a nice extra question, IMO.
19h
revised Import nested JSON file
added some notes...
19h
answered Import nested JSON file
1d
comment Why should we make sure the calculated MD5 is of length 32?
@Felix: not exactly, Hash returns a number (Integer), for which something like leading zeros does not really exist. It is IntegerString which would not pad the (hex) string representation of that number with zeros unless you tell it...
2d
comment Export to MX seems to corrupt the in-memory Dataset
Sorry, I can't check with 10.1 at the moment, don't have it installed on my computer at this time. I think you should report this as a bug. Unfortunately I also don't know of a workaround other than reloading...
2d
comment Export to MX seems to corrupt the in-memory Dataset
I have no solution, but I have seen similar behavior when I was writing (relatively) large Datasets in an earlier version 10 (I think it was 10.0.1). I have never investigated what it was and just reloaded as you do in the second example (which was almost immediate in my case). I just checked and found it does not happen for my case with 10.0.2 on Windows anymore. Which version are you using?
May
21
comment Why different output is obtained for the same code (Mathematica 10.1)?
@Misery: well, then it looks like a different problem. Unfortunately I also don't see the problem so it is difficult to help...
May
21
comment Why different output is obtained for the same code (Mathematica 10.1)?
How long does that Simplify take on your computer? If your computer is very slow it could happen that you run into the TimeConstraint that is set for Simplify when evaluating the first time. Following evaluations will then take advantage of cached intermediate results and get further in the evaluation and thus return a different result. If that's the case I think it is a known problem but not "broken-code"...
May
21
comment Unexpected behavior of WhenEvent in NDSolve?
I have added my comment as an answer, so if you want you can accept it and make that question disappear from the unanswered list...
May
21
answered Unexpected behavior of WhenEvent in NDSolve?
May
20
comment Unexpected behavior of WhenEvent in NDSolve?
great, I wasn't sure but as I struggled about this myself it was an easy guess :-)
May
20
comment Unexpected behavior of WhenEvent in NDSolve?
I'm not sure what you are doing, but for me y[4.4]/.sol returns an InterpolatingFunction which is valid from 0.01 to 5.14 and that seems to be the value where y' becomes zero as desired. You can of course still plot it but for values larger than x=5.14 but then only an extrapolation of that InterpolatingFunction is plotted, nothing that has anything to do with the real solution. I'm not sure why they changed the older behaviour where you'd have seen a bunch of warning messages but in any case you should check the end point before plotting when using "StopIntegration"...
May
19
comment Running bits of code in a separate kernel
a quick fix which will not solve your problem but probably makes it less problematic could be to set $HistoryLength=0 which will probably help in decreasing the memory consumption. For running in extra kernels you could have a look at the parallel functionality. If you use that with only one parallel kernel and do CloseKernels once in a while that probably is the most convenient interface to do what you want. For your application using more than one kernel in parallel would probably also make sense. It would certainly also be possible to start a kernel with lower level functionality...
May
11
comment NDSolve computes wrong solution?
I get the same result, looks like a bug to me, most probably in the relatively new FE code. It is just a suscpicion, but Method->"MethodOfLines" complains that it can't handle that case of boundary conditions (which I think is also reasonable) which only leaves Method->"FiniteElement". I'd report it to WRI. Probably just a simple sign problem as you can get what looks like the desired result when switching the sign in the boundary condition to -5*t :-)
May
9
comment How can export into an .XYZ file using decimals without scientific notation?
there is some documentation for the XYZ format import/export. I have not studied it in detail, don't know the XYZ format and format documentation is generally rather poor, but I think you will need at least using string instead of symbols ("VertexTypes" vs. VertexTypes) and als use "Rules" for the element description. I would play around with the examples in the documentation (/ref/format/XYZ in the documentation), that usually gives you a feeling about what works...
May
8
comment Importing large data without using Import
concerning memory: do you know about $HistoryLength=0? if you don't do that Mathematica will remember all output you ever generated in a session. concerning import: if changing the simulation, I'd consider another format for your files, text is just not a very good encoding for numeric data. Other than that, you might find this question and answers to it helpful. If sticking with text, you can read lines with ReadList and type String instead of BindaryReadList as in the answer...
May
8
comment Importing large data without using Import
and the code writes the presumably numeric results into text files? Can you change that and make that code save something else? It certainly is possible to read in these text files, but it might in total consume more time than changing the data format (in case that is possible)...
May
8
comment Importing large data without using Import
do you generate the data with mathematica and reread it with mathematica? If yes, then use Dump and Get as you suggested (although I think Export[filename,expression,"MX"] is slightly cleaner). Anyway, if you want the data to be accessable with other programs you could also look at specific file formats like HDF5 which are at least partially supported from Mathematica and will be a much better choice to store large numeric arrays, even a whole collection in one file...
May
5
comment Is Mathematica intended to be used to do lengthy algebraic clculations?
is your problem that it takes you longer to write the input for Mathematica to do the calculation or that Mathematica itself is slow? Mathematica is definitely used for algebraic calculations which are too much work to do by hand in any chance (e.g. feyncalc), but it needs some experience and effort to make it perform these efficiently. For very demanding calculations, you might have to switch to specialiced packages though...
Apr
26
revised Exporting multiple arrays in a single HDF5 file in Mathematica 7
added note about version 10.0.2 also working