nikie
Reputation
20,434
Next privilege 25,000 Rep.
 Mar 23 comment How can I optimize the search between two lists, one that is changing length? If you really want to find out about n=6, get a book like "Hackers Delight", translate the transpose/reverse operations to bit-twiddling operations, and learn C. Back-of-the envelope calculation suggests that it should be possible to run this for n=6 in hours. But that it something you'd have to do yourself ;-) Mar 23 comment How to define a set of two random orthogonal unit vectors? n[k_]:= defines a function of k. If you call it 3 times with the same argument, it gets evaluated 3 times and you get 3 different random vectors Mar 23 comment How can I optimize the search between two lists, one that is changing length? If you're going to use Association, you should probably read the documentation and tutorials in MMA. Anything else will only lead to frustration. That said, you probably want Export[... Keys[uniqueArray] ...] Mar 23 comment How can I optimize the search between two lists, one that is changing length? Try this: open a new notebook, restart the kernel, copy&paste your code from the start up to (and including) m[1]; // AbsoluteTiming and run. I get a lot of warnings then, apparently on the second call to m. Maybe some cleanup is missing from m Mar 22 answered How can I optimize the search between two lists, one that is changing length? Mar 22 comment How can I optimize the search between two lists, one that is changing length? FWIW, I'd try to replace AppendTo with an Association, which should make insertion faster Mar 22 comment How can I optimize the search between two lists, one that is changing length? How large would you like n to get? Even if you'd optimize the Table calculation to do one iteration per nanosecond, n=8 would take over 500 years. 2^n^2 simply grows very fast. Unless you come up with a different algorithm, anything above n=5 or maybe n=6 will take a very long time. Mar 18 comment How to Flatten and stack Efficiently 50000 Images Like I said, you can avoid the memory cost, but there's not much you can do to improve Import's speed without rewriting the functionality. Mar 18 answered How to Flatten and stack Efficiently 50000 Images Mar 18 awarded Enlightened Mar 18 comment ImageData reverses the order of the row of an Image But indices still start at 1, coordinates at 0. Plus, rotating the whole image just to get one pixel is horribly inefficient. I'd prefer with GetPixelValue... Mar 18 awarded Nice Answer Mar 18 revised ImageData reverses the order of the row of an Image added 998 characters in body Mar 18 comment Total and partial derivatives Maybe what you want is: ff = f[x, y]; Dt[ff, x] - (D[ff, x] + D[ff, y] Dt[y, x]) Mar 18 comment Total and partial derivatives D is applying the chain rule. What else would you expect? If y were e.g. Sqrt or Sin, would you expect D[f[x, Sin[x]], x] == f'[x, Sin[x]]? Mar 18 answered ImageData reverses the order of the row of an Image Mar 14 comment Measure perimeter of black edge in Mathematica @yode: I think it's because you use Dilation[..., 1], which uses BoxMatrix[1] as structuring element - meaning, you're using an 8-neighborhood, where I use a 4-neighborhood Mar 14 awarded Enlightened Mar 14 awarded Nice Answer Mar 14 awarded image-processing