Reputation
715
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
4 13
Impact
~16k people reached

  • 0 posts edited
  • 0 helpful flags
  • 74 votes cast
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]* NDSolve`FiniteDifferenceDerivative[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.
May
26
accepted Speed up derivative evaluation
May
26
comment Speed up derivative evaluation
`@Bichoy, great improvement ! another 15x speedup. Does compile support interpolation functions?
May
26
revised Speed up derivative evaluation
added 33 characters in body
May
26
asked Speed up derivative evaluation
May
3
accepted Take sublist with fixed interval
May
2
comment Take sublist with fixed interval
@2012rcampion yes, I found it in the basic examples.