Jonie
  • Member for 8 years, 10 months
  • Last seen more than 5 years ago
How to find first list element that differs from average of N previous elements by more than a given amount?
Accepted answer
8 votes

Here's an attempt (without select) lst = {1, 2, 2, 1, 2, 5, 2, 4}; n = 4; p = 1; Flatten[If[Abs[Take[#, -1] - Mean[Drop[#, -1]]][[1]] > p *StandardDeviation[Drop[#, -1]], Take[#, -1], {}] & /@...

View answer
Slow work of SQLInsert with SQLite
7 votes

Firstly, a bit about SQLite insert performances: https://stackoverflow.com/questions/1711631/how-do-i-improve-insert-per-second-performance-of-sqlite https://stackoverflow.com/questions/3852068/...

View answer
Filling a plotted line both below and above the line
6 votes

This works: Plot[1 - x, {x, 0, 1}, Filling -> { 1 -> Top, 1 -> {Bottom, {Green, Blue}}} ] but I think there may be a neater solution.

View answer
How to access graphics from .NET in Mathematica?
Accepted answer
6 votes

I'm presuming that you already have a command which generates a graphics and you're trying to retrieve it through the MathKernel. If so, try the following: 1. Set the CaptureGraphics Property on ...

View answer
Is there a "precedence table" for the canonical Sort ordering?
5 votes

Ahh good fun questions. Anyway this isn't a comprehensive answer but rather just a quick test on the basics: list = {0.1, I, 2 + I, 0, 2 , 2 x, x, xxx, 2^x, x^2, x^x, x^ (2 x), X, xX, "y", "yy", "Y"}...

View answer
"Unflattening" a list
4 votes

One possible solution list = {{{2, 3}, {2, 4}}, {{{3, 4}}}, {{5, 6}, {7, 8}}} {{{2, 3}, {2, 4}}, {{{3, 4}}}, {{5, 6}, {7, 8}}} list1 = Flatten[list, 1] list1[[1]] = {2, 8}; list1 {{2, 3}, {2, ...

View answer
Removing coefficients and repeated elements
3 votes

You could use a replacement rule to change all the negatives to positives, followed by DeleteDuplicates[]. array = {1, x1, -x1, x2, x5, x3, -x2, -x4} DeleteDuplicates[array /. Times[-1, x_] -> x] ...

View answer
Aborting a computation correctly in .NETLink to allow future computations
Accepted answer
2 votes

See edit at the bottom for faster solution. To get this working in an actual implementation there are a few things to note, as it took me a lot more effort to get it from the prototype to the ...

View answer
Displaying a small histogram overlay on a large image
2 votes

You could try using an epilog with inset though I'm not sure how much more efficient that'd be compared to the method you have. TestData = {10, 14, 8, 6, 4, 3, 2.5, 2, 1.5, 1}; TestDataSmall = {2.5, ...

View answer
Computing the mean difference between elements in a list with index $i$ and the closest elements with index $(i+1)$
0 votes

Here's the functional naive but slightly faster implementation: f3[lis_] := Module[{}, min = Min[lis[[All, 1]]]; max = Max[lis[[All, 1]]]; t = Table[Select[lis, #[[1]] == i &], {...

View answer