172 views

Three important points: Fourier is symmetrical with half of the data repeated (you see this in your plot) There is a DC term. You want to filter the original signal, not the Fourier. And make sure ...

141 views

As others have said, the original data is too far off a linear fit to have any points survive your constraint. I think this function will do what you want: TrimDataWithLinearFit[{data_, ...

526 views

I like what @halirutan did and had a slight riff on it that appears to yield a better result. Rescale[With[{meanFiltered = MeanFilter[#, 50]}, # - meanFiltered] &amp; /@ ImageData[img, "Real"]] // ...

3k views

My machine specs seem identical to @rohit-namjoshi yet my result is different: {{&quot;System&quot;, &quot;Mac OS X x86 (64-bit)&quot;}, {&quot;BenchmarkName&quot;, &quot;WolframMark&quot;}, {&quot;...

263 views

I think this will do what you want: s = NDSolve[{r''[t] == r[t]*\[Phi]'[t]^2 - 1/r[t], \[Phi]'[t] == #[]/r[t]^2, \[Phi][ 0] == #[], r == #[], r' == #[]}, {r, \[...

40 views

The solution shown is fine but if you want to extend it to n-dimensions, try this: g[a_List] := Total[#^2] &amp; /@ a Now, if you give this: nDim = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; g[nDim] (*{14,...

243 views

I think this might work for you: Elaborate[aList_List] := Block[ {result, splitList, currentPosition}, result = {1}; currentPosition = 0; splitList = Split[Reverse@aList]; (If[First[#]...

280 views

I think this would do what you want: writefile[instr1_, instr2_, filename_] := Module[{str1, outstr, stream}, str1 = "abc\n" &lt;&gt; instr1 &lt;&gt; "\n" &lt;&gt; "def\n" &lt;&gt; instr2 &lt;&...

101 views

I like the solution from @morbo but think that Subsets is better in this case than Permutations. Permutations will give {1,3} and {3,1} (thinking of this as a set of three values and just looking at ...

910 views

Or this (inspired by the FindSequenceFunction reported by @march): ClearAll[aList, sf,testList]; aList = {1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8}; sf = FindSequenceFunction[aList]; ...

194 views

Or another variant: DateListPlot[ReplacePart[#, 1 -&gt; Prepend[#[], 2020]] &amp; /@ data]

924 views

I didn't at first understand the problem statement. We are subtracting the second list from the second element of the first list. With that understanding, here is another possibility: Transpose[{...

51 views

This might give you what you want. ClearAll[ratioFile,knownRatios] ratioFile=SemanticImport["http://www.huygens-fokker.org/docs/intervals.html"]; knownRatios=Association[Flatten[StringCases[#, a:...

212 views

I don't know if this is what you had in mind, but playing around with what you are doing, I came up with a couple of new routines. ClipAll[nElements_List, min_, max_] := Thread[Clip[nElements, {...

56 views

I frequently use this shorthand (use "-1" for last or could also use "2"): Btc[[;;,-1]]

117 views

I think I may have figured this out. Looking up TreeForm, I found FullForm. anExpression = 5.101102275075902 + E^(-6876.316769642943 t) (-5.101102275075902 + 1. vStart); depth = Depth[...

302 views

If you want the braces for the output as you say, then you could do something like this with a pure function: someInput = RandomInteger[{1, 10}, {10, 4}] {Total[#]} &amp; /@ someInput (* {{5, 9, 9, 9}...

98 views

Something like this might work for you: fnew[D1_, D2_, x_] := -2 Sqrt D1 Cos[x/2] - D2 Sin[x]; fnewSolution[D1_, i_] := Block[{D2 = D2start + i*D2step, minsol, theX}, minsol = NMinimize[fnew[D1, ...

117 views

Inspired by @kglr and extending to arbitrary dimensions on the data, this may do what you want: data = Module[{size = 11}, Table[If[PrimeQ[a + b], True], {a, 1, size}, {b, 1, size}]]; With[{...

115 views

I don't think this is quite correct. To test my hypothesis, I created this: NextXY[{x_, y_}] := {x - 5 y, 2 x + y} Then, I created some points: somePoints = {#, NextXY[#]} &amp; /@ Flatten[...

144 views

Perhaps not very satisfying, but I was able to get this to complete in a reasonable amount of time (1 minute, 16 seconds): plotValues = ParallelTable[{x, FS12[x]}, {x, 0.01, 2, .01}]; ListPlot[...

128 views

There are perhaps more elegant answers, but let's say you want to scale the x-axis by 10^17. Then this would do that: equation1[ F_] := (3.47471*10^31 (3.525 + 3.83003*10^-10 F^2))/(0.5814 + ...

81 views

Would something like this do what you want: Block[{outlierPositions = Flatten[Position[SomeData, #] &amp; /@ Select[SomeData, ! (#[] - #[] &lt; 0.2) &amp;], 1], replacements}, ...

581 views

Might not be so elegant, but try this: (* create a test array *) startingArray = ArrayReshape[Range, {6, 6}]; startingArray // MatrixForm all4x4 = Partition[Partition[#, 4, 1] &amp; /@ ...

33 views

This might work for you. timeRules = {"m" -&gt; "Minutes", "hr" -&gt; "Hour", "min" -&gt; "Minutes", "h" -&gt; "Hour"}; ParseTime[timeString_] := With[{numberString = First@StringCases[...

258 views

I will update this with the plot (if it ever finishes!). Here is some code that I believe computes the value: thePoints = ParallelTable[ {x, y, NestWhile[ {#[] + 1, Quiet@Chop[zStart^...

96 views

Another alternative: Join[#[[1 ;; 3]], {#[] &gt; 2 b, #[]}] &amp; /@ data

814 views

The following seems to have slightly less "wiggle" and doesn't need tuning: ClearAll[allXValues,minY,maxY,nearestMax,nearestMin] allXValues = Sort[pts[[;; , 1]]]; {minY, maxY} = MinMax[pts[[;; , -1]]]...

150 views