Skip to main content
a20's user avatar
a20's user avatar
a20's user avatar
a20
  • Member for 10 years, 3 months
  • Last seen more than a month ago
awarded
awarded
comment
StreamDensityPlot: Two legends instead of one
No issue in 12.1.0 for Linux x86 (64-bit) (March 18, 2020), although v 12.0 reproduces the issue. In the future, please only put a minimal example here, it is enough to just do a StreamDensityPlot with PlotLegends->BarLegend[{"ThermometerColors",{0,1}}] to produce the issue.
comment
Replacing elements at a single level in a nested list
What is the difference between this (levelspec as {1}) and the answer I proposed (levelspec as 1)?
comment
How to group elements of a tuple into groups of 6 elements each?
I am not sure I follow. In your inputTup you have eight lists and in your outputSample you have six lists. The first six lists in inputTup are equivalent to the six lists in outputSample. You are wondering how to go from inputTup to outputSample? Or you are wondering how to take a generic list of eight elements (a1->a8) and then create a list of lists, where the a1->a8 elements are ordered as specified in each sublist?
revised
Loading…
revised
Loading…
Loading…
comment
Import strategies for large .txt files ~600MB
If you want help, you need to provide the following: *minimum example of working code *sample data *a plot to show what your end result should look like. This does not mean that you have to post the real data, if it is confidential or for whatever other reason. Just create some data in the same format, and make a plot out of this and post everything here.
comment
Anti-cheating elements in a Mathematica notebook
@yarchik collaboration is good, but simply getting a copy of someone else's work because you were too lazy is not good... However, it is of course possible that two students collaborate on one single computer, and then the notebook would of course be identical, even though there was no cheating involved. Anyway, I suppose that OP would not simply fail a student for having an identical notebook, but would rather focus a few extra questions to those students to see that they have actually understood the problems and solutions.
comment
How do I optimize a simulation containing both a While loop and a Do loop?
You missed that he is iterating over RandomVariate. My solution only takes 0.24 seconds for n=1000.
revised
Loading…
Loading…
comment
How do I optimize a simulation containing both a While loop and a Do loop?
Thanks for the update. mod is currently not returning anything. What are we supposed to look at? Also, when I run mod[] now, it takes me about 0.008 seconds. This could certainly be made faster, but just running this 1000 times should not be a major concern? Can you please show how you call the sampl function?
comment
How do I optimize a simulation containing both a While loop and a Do loop?
When optimizing, it is good to take out each part by itself and wrap it with AbsoluteTiming[] to see where the bottlenecks are. One problem with your code is that you use AppendTo[], this is very slow since it has no assumption on the datastructure and rebuilds the complete list every time. One option is to use Reap and Sow instead. Another is that you e.g. initalize a list x = Table[0,{1,xmax}] and then set x[[i]] = t, or even better if you could work on a complete list at one time such as x = listOfTresults
comment
How do I optimize a simulation containing both a While loop and a Do loop?
It would be helpful if you could provide a full working example. Now OtherPart[] is not defined. There is also no input to the function (sampl?) that we can try.
awarded
answered
Loading…
awarded
comment
Add gaussian noise to 2D Point
Could you please provide an example of the data that you have and the code that you use to manipulate it?
1
2 3 4 5
9