42,881 reputation
566175
bio website
location
age
visits member for 2 years, 7 months
seen 3 hours ago

Jan
27
comment Sorting lists element by element
@Mr.Wizard, thanks for the reminder. For some reason the stable sort syntax just won't stick in my brain.
Jan
26
comment Poor CUDALink performance, when calling a kernel multiple times
There's no easy way! AFAIK there is no publicly available documentation for the CUDALink DLL, you are expected to use the CUDAFunction interface and not worry about the details. If you want to dig into the Mathematica code behind CUDAFunction you can use the "Spelunking" package here. However, it will be a lot of guesswork and experimentation to get anything working. It might end up being easier to write something in C and call that, or (if possible) change your algorithm to do a few large calculations rather than many small ones.
Jan
26
comment Recognize simple shapes in an image and color them randomly?
@rasher, it's probably easier to modify the component matrix than the color function. e.g. Colorize[Mod[863 #, 231], ColorFunction -> "Rainbow"] &
Jan
26
comment Mathematica Library
Possible duplicate?
Jan
25
comment Poor CUDALink performance, when calling a kernel multiple times
Just running the CUDA kernel 1000 times takes about 0.06s on my PC (Do[CUDALink`Private`cLaunchKernel["Double"][], {1000}]) compared to 0.9s for Do[fun[gpuC, gpuA, gpuB], {1000}]. The overhead is validity checks on the function arguments and options, calculating the grid size, and multiple calls to the CUDALink DLL to set the cubin binary, the kernel function, function arguments and the block and grid sizes, then launch the kernel and finally deal with the output.
Jan
25
comment Labelling objects in a picture with numbers
IMO it would be cleaner not to wrap the centroids in the extra list in the first place (by removing the list braces from {"Centroid"}) and then just use Text @@@ cenData
Jan
25
comment Labelling objects in a picture with numbers
@andy, you can edit your question (click the edit button beneath the question) and simply copy and paste your code in. To format it as a code block you select the code and click the "Code Sample" button (looks like {}). There is more detailed formatting help here and general advice on asking a good question here
Jan
24
comment Fast method for combining two lists
You can get a bit more speed by rearranging the expression to remove one of the multiplications: vL (v1 - v2) + v2, and then a bit more by using Subtract: vL Subtract[v1, v2] + v2
Jan
22
comment Why are numeric division and subtraction not handled better in Mathematica?
I see similar results to Ymareth on an i5 processor (win7, MMA 9.0.1) - all methods use all 4 cores roughly equally but the multiplication versions run at about 40% CPU with Divide at about 70%
Jan
22
comment Coloring the points in a ListPlot with the value of another function
@Edouard, for a large number of points I would suggest using a gradient color scheme, for example: c = ColorData["Rainbow"] /@ (Range[25]/25);
Jan
20
comment Better way to plot multiple discrete PDFs?
In my opinion there is a problem with this plot, in that the steps occur at integer values on the k axis. e.g. the value of the magenta curve at k=1 is both 0.12 and 0.27. Unless you know the code that was used to create the plot, there is no way to tell which is the correct value.
Jan
20
comment How do I fill the area from 0 to pi in my Sine wave and in the process get the area value?
@AliGajani, I think you are looking for the indefinite integral Integrate[Sin[x], x]. You may benefit from reading the documentation for Integrate, perhaps start here: How to Do an Integral
Jan
16
comment Moving maximum function?
List manipulation questions almost invariably end up as a timing contest because there are so many ways to accomplish the same thing :-)
Jan
16
comment Moving maximum function?
For long lists it's probably slightly quicker to map Max rather than Apply it.
Jan
16
comment Plotting in the “Manipulate” function - simple coding
By the way, "concentric" means having the same centre, which your circles don't. I suggest choosing a different terminology :-)
Jan
12
comment How to make a drop-shadow for Graphics3D objects
@MichaelE2, many thanks for the improved initialisation code - I just couldn't figure out how to get it right.
Jan
7
comment How can I get an approximate contour plot from a 3D plot?
Is there a reason not to use ContourShading -> None to remove the polygons?
Jan
7
comment Why x = x doesn't cause an infinite loop, but f[x_] := f[x] does?
@Rojo, interestingly p:f[x_] := p does not loop
Jan
4
comment How can I make my output to be added to an existing list?
+1 but note that Mod is Listable so there's no need to map it: Outer[Plus, v, v, 1] ~Flatten~ 1 ~Mod~ 2
Dec
28
comment Deleting powers of a common prime except the highest one from a list with further only primes
@Mr.Wizard, nice. Your strip3 is what I would use.