novice
Reputation
770
Top tag
Next privilege 1,000 Rep.
 Apr 19 awarded Popular Question Jan 27 awarded Popular Question Jan 19 awarded Yearling Dec 7 awarded Popular Question Nov 18 awarded Notable Question Nov 18 awarded Good Question Jul 20 comment compute the gradient in high dimension @Jens, for different units (e.g. distance and angle), I added If[ i == angledim, Pi, 1] to the code computeGrad[data_, order_: 2] := Module[{n = ArrayDepth[data]}, MapThread[List, Table[If[i == angledim, Pi, 1]* NDSolveFiniteDifferenceDerivative[UnitVector[n, i], Range /@ Dimensions[data], "DifferenceOrder" -> order][ data], {i, n}], n] ]; Jul 17 comment Applying a function to a list with fixed intervals and fill the resulting list @ belisarius, not a good example. It should like this: using {{5, 5, 5}, {5, 5, 5}, {5, 5, 5}} to approximate {{4.6, 4.7, 4.8}, {4.9, 5, 5.1}, {5.2, 5.3, 5.4}}. Something like using the average value to smooth the list, or the first pic shown here : philipbjorge.com/2011/12/02/… Jul 17 comment Applying a function to a list with fixed intervals and fill the resulting list @ belisarius, In fact the function f does not matter, I only need to find a subset of a list to approximate the list uniformly(i.e. fixed interval), on the condition that the approximation list has the equal size. It is like using {{5, 5, 5}, {5, 5, 5}, {5, 5, 5}} to approximate {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}. In Chebyshev metric, the elements are 1 element neighbor of 5. Jul 17 accepted Applying a function to a list with fixed intervals and fill the resulting list Jul 17 comment Applying a function to a list with fixed intervals and fill the resulting list @ belisarius, I present a short list for demonstration. The interval is 3, because each element has 2 neighbors. The interval seems unequal at first sight in this specific example, because the resulting list has to match with the original list in length. So I have to apply 'f' to the last element. I was thinking someone had encountered the same problem with me. I think it could be closed. Jul 16 comment Applying a function to a list with fixed intervals and fill the resulting list @ciao, it seems the question is not stated clearly. I added some explanation to my question. Jul 16 revised Applying a function to a list with fixed intervals and fill the resulting list added 17 characters in body Jul 16 revised Applying a function to a list with fixed intervals and fill the resulting list added 478 characters in body Jul 16 revised Applying a function to a list with fixed intervals and fill the resulting list added 89 characters in body Jul 16 asked Applying a function to a list with fixed intervals and fill the resulting list Jun 21 awarded Popular Question May 27 comment Speed up derivative evaluation @@Michael E2, the idea of vectorization is great. I get 20x speedup. I am curious about where does the time-saving come from? What if normalVector is also a function of θ? May 26 comment Speed up derivative evaluation @@Bichoy, I think Compile fails for functions containing D. The compiled version is slower. May 26 comment Speed up derivative evaluation Nice tip for speedup.