Tag Info

Hot answers tagged

6

Update: This seems to be a problem restricted to 32 bits Windows systems Just copying your first line random = {RandomReal[{-1, 1}, {500, 5}], RandomReal[{-1, 1}, 500]}; and then a slight change: mods = Tally@Table[LinearModelFit[random], {1000}] I tally the resulting FittedModels. I sometimes get only a single model (counted 1000 times) and ...


6

To demonstrate the time saving using a linked list instead of AppendTo :- time1[myN_] := First@Timing[ finalList = {}; For[i = 1, i <= myN - 3, i++, For[j = i + 1, j <= myN - 2, j++, For[k = j + 1, k <= myN - 1, k++, l = RandomInteger[{k + 1, myN}]; AppendTo[finalList, {i, j, k, l}]]]]]; time2[myN_] := First@Timing[ ...


6

Another possible path is to extend Vitaliy's function FindCrossings2D to 3D In its current form, it is inefficient and somewhat buggy. Identify all 3D extrema Start with a Gaussian random field u = GaussianRandomField[16, 3, Function[k, k^-1]] // Chop // GaussianFilter[#, 6] &; Build its gradient fu = u // ListInterpolation[#, Method -> ...


5

We can transform the image into polar coordinates, after which averaging across angles is trivial. polarTransform[img_, rmax_] := With[{size = Max@ImageDimensions[img]}, ImageTransformation[img, Function[{r, t}, {r Cos[t], r Sin[t]}] @@ # &, {rmax, 2 Pi rmax}, DataRange -> {{-size/2, size/2}, {-size/2, size/2}}, PlotRange -> {{0, ...


4

Let me start and answer my own question (with what I have so far) since it might trigger some interest before the bounty expires. The motivation is to find rapidly 3D maxima of the field. Posible idea The idea is to define 3D maxima, as the intersection of the union of 2D maxima (using 'MaxDetect') sliced in two different directions. Starting with a ...


4

How about using nesting ImageRotate: t = NestList[ImageRotate[#, 5 Degree, Full] &, img, 71]; ImageData /@ t; out = Total[%] // Image // ImageAdjust Extracting a line looks similar to yours idata = ImageData[out]; ListPlot[idata[[All, 512]], PlotRange -> {{512, 652}, {0.4, 1}}, Frame -> True]


1

With h = {5, 4, 2, 8, 9, 1} and indices {1,3,5,6} h[[{1, 3, 5, 6}]] is {5,2,9,1} and Max[h[[{1, 3, 5, 6}]]] is 9, so Position[h,9] is {{5}} en we get rid of the double brackets by `Position[h,9][[1]]` all-in-one becomes Position[h, Max[h[[{1, 3, 5, 6}]]]][[1, 1]]


1

For example: experimArray = Range@20; theoretArray = ListConvolve[{a, b, c, d, e}, Range@24] sol = NMinimize[Norm[experimArray - theoretArray], {a, b, c, d, e}] So: theoretArray /. sol[[2]] (* {1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20.} *)


1

Seems like the problem is not solved completely in the previous post. For this problem, it is straightforward to obtain the positive semi-definite condition of S by Cholesky decomposition, which all the diagonal elements should be nonnegative. Diagonal[CholeskyDecomposition[S]] After some simplification, it can be shown the diagonal elements are {1/r, ...


1

Here is an other image processing alternative. The main idea is as a pre-processing step using Gradient Filter. (I think most of them may work in 3D as well.) img = Import["http://i.stack.imgur.com/g7TFl.png"]; imgG = ColorConvert[img, "Grayscale"]; imgA= ColorNegate@GradientFilter[imgG, 3] // ImageAdjust imgB= ImageMultiply[MeanShiftFilter[imgG, 2, 0.3, ...



Only top voted, non community-wiki answers of a minimum length are eligible