Reputation
11,933
Next privilege 15,000 Rep.
Protect questions
Badges
2 30 59
Newest
 Guru
Impact
~143k people reached

Apr
22
comment Using a For-loop to do numerical integration
And if you really want to recalculate the integral (or any expression) for a range of values, use Table, not For.
Apr
22
comment Using a For-loop to do numerical integration
If you want to evaluate an integral for a range of xd, you can use NDSolve - it returns a function instead of a single value
Apr
17
answered Integrating the second derivative of a 3D curve
Apr
15
comment Efficient way to perform local Otsu thresholding on image
as a workaround, you could calculate thresholds for every nth pixel, and interpolate in between.
Apr
7
revised cross point of intersecting lines
added 544 characters in body
Apr
7
answered cross point of intersecting lines
Apr
7
comment Looping within linear programming
Also, // does not start a comment in Mathematica code!
Apr
7
comment Looping within linear programming
This question would be much clearer if you posted the code that actually takes too much time. I've tried your first two code blocks, and neither takes more than a few milliseconds. Without that, the only tip that comes to mind is use FindMinimum instead of Minimize. Minimize tries to solve the problem symbolically, which is in general more expensive. FindMinimum uses local optimization, which is usually fastest, and for an LP is guaranteed to find the global minimum.
Apr
5
awarded  Guru
Apr
5
comment Is association in mathematica ordered or not?
@Nasser: It's not the most frequent use case, but sometimes you want to aggregate data in an Association, then later process the key/value pairs in the order they were discovered. And I often find it handy that BarChart, ListPlot&friends don't jumble association data I pass them. So I'm glad Wolfram made them ordered.
Apr
5
comment Ordered associations
Not exactly a reference, but Sort and KeySort return sorted associations (and that's documented behavior). That wouldn't make any sense if associations were unordered.
Mar
24
comment Extracting road curves from an image
@P.Fonseca: I tried, but exported as gif the animation was ~30 MB... (swf and qt were both between 1-2 MB)
Mar
24
awarded  Enlightened
Mar
24
awarded  Nice Answer
Mar
24
revised Extracting road curves from an image
added 3 characters in body
Mar
24
comment Extracting road curves from an image
@Pickett: Weird. The documentation doesn't say that this syntax is new, and I could have sworn I've used it like this since v8. OTOH, the speed difference isn't that large (in this case) so I'll change it to your version.
Mar
24
comment Extracting road curves from an image
@Pickett: Weird. I've just executed the code in a fresh MMA session, and except for the Show-problem Zviovich mentioned, it worked fine. Does whitePixels contain a list of 2d coordinates in your session? Or maybe -> Automatic syntax is newer than your MMA version?
Mar
24
comment Extracting road curves from an image
@Zviovich: I've used bgnd=Image[bgnd], to make my experiments with colorDist faster. I didn't realize this changed the behavior of Show. I've updated my answer. Regarding the title: Maybe something like "Extracting road graphs from an image"?
Mar
24
revised Extracting road curves from an image
added 12 characters in body
Mar
23
answered Extracting road curves from an image