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

Mar
2
answered GUI and Dynamic update problems
Mar
2
comment NDSolve with varying PrecisionGoal and WorkingPrecision
I think this doesn't really do what you expect and the OP intended: if you give a start value for x=0 but ask NDSolve to solve for x=5 to x=30 in the second call it will actually solve from x=0 with high precision but only store the results from 5 to 30 in the result. If you want to only solve with low precision you should instead give the lower precision endpoint result as starting value for the second call, something like: y[0] == SetPrecision[(y /. First@low)[5], 50]...
Feb
11
revised How to make a single-variable out of a NDSolve solution?
added 149 characters in body
Feb
11
comment How to make a single-variable out of a NDSolve solution?
@Sektor: I of course appreciate your politeness :-)
Feb
10
comment Changing package content in batch
I'm actually surprised that my comment seems more relevant than I thought. The problem is that importing and reexporting won't create the same thing as the Mathematica-specific "ascii"-encoding of special characters is only correctly done when using the CharacterEncoding option for Export. Here is an example to play with: ExportString[ImportString["b [Rule] a", "Text"], "Text"]. Of course this is mainly relevant if the package files are generated from a notebook with the auto save as package functionality, otherwise you probably won't expect such characters in a package file...
Feb
10
comment Changing package content in batch
I don't know of any voodoo for the "Text" format, the only thing you should be aware of is the character encoding, the default for text import/export is UTF8 and AFAIK package files typically are interpreted as pure ASCII. As that is a subset of UTF8 it probably only will make a difference if you use non-ascii characters within a package file (which one probably shouldn't do in the first place). I can't recall the details by heart, though, so you might need to look that up yourself...
Feb
10
comment How to make a single-variable out of a NDSolve solution?
@Sektor: thanks for pointing out, I actually changed that line so it shows the data that I was explicitly generating before already, which shows more clearly what I try to point out. Are you aware of the fact that you can in such cases edit the answer yourself? I think such corrections are common and welcomed on this site...
Feb
10
revised How to make a single-variable out of a NDSolve solution?
deleted 35 characters in body
Feb
9
answered How to make a single-variable out of a NDSolve solution?
Feb
6
comment How do we make a negative integer out of a string of a negative number and vice-versa?
... and of course this questions and the corresponding answers might also be of interest...
Feb
6
comment How do we make a negative integer out of a string of a negative number and vice-versa?
I think ToString and ToExpression are what you are looking for. As for your matrix-input, you might look at this question
Feb
3
comment Kinetic Friction in Mathematica, weird behaviour
@george2079: it is documented to detect sign changes: "f==0: the function f of the solution variables crosses zero" (from ref/WhenEvent).
Jan
25
revised Reading periodic elements from a large file
removed unnecessary Or from code
Jan
22
revised How to minmize the memory problem in a compile function for a given code?
added 302 characters in body
Jan
22
comment ParametricNDSolve: Parameter inside UnitStep leads to longer integration times
One more comment: in my opinion there actually is a problem with ParametricNDSolve: there is only very vague documentation about what it does internally ("Derivatives of ParametricFunction are computed using a combination of symbolic and numerical sensitivity methods when possible."). One can make some guesses from the method options and examples but it's really difficult to make a reasonable guess about what kind of optimizations we can expect to be done and what the premises are for them. Maybe one day there will be another section in the advanced ndsolve docs...
Jan
22
comment ParametricNDSolve: Parameter inside UnitStep leads to longer integration times
Of course my comparison is somewhat oversimplified -- but there is certainly also some overhead in what ParametricNDSolve does/tries to do. While it might be well justified to claim that there is still potential for further optimization of ParametricNDSolve, I find the claim "there is a large issue" with it a little overdrawn -- after all you give no indication that it does something wrong and it isn't (much) slower than a naive approach. And I find it makes perfect sense that the case with a parameter in UnitStep is much more difficult/expensive than the almost trival one...
Jan
21
comment ParametricNDSolve: Parameter inside UnitStep leads to longer integration times
I'm not so sure whether this is not the contrary of a problem but a good example of why ParametericNDSolve is useful: the time to run just NDSolve for every value of RATE is about the same as that for the two-parameter case. The one-parameter case is much faster and that might well be because ParametericNDSolve can do an optimization for that case that it can't do for the (highly nonlinear) case where the parameter is in the UnitStep. Of course, I'm just guessing...
Jan
21
comment How to minmize the memory problem in a compile function for a given code?
@santosh: if I understand correctly that's easy enough, see my edit in the answer...
Jan
21
revised How to minmize the memory problem in a compile function for a given code?
added note about storing only diagonal elements
Jan
20
revised How to minmize the memory problem in a compile function for a given code?
added 19 characters in body