开发者

MapThread, Manipulate, Filter in Mathematica

开发者 https://www.devze.com 2023-03-16 19:15 出处:网络
I hope to be able to name that question properly soon. Please Consider : list1 = Tuples[Range[1, 5], 2];

I hope to be able to name that question properly soon.

Please Consider :

list1 = Tuples[Range[1, 5], 2];

list2 = Tuples[Range[3, 7], 2];

*I use the below mechanism to开发者_如何学C display all filtered eye fixations during a display. *

Manipulate[Row[
               MapThread[Function[{list},
                         Graphics[
                         Point[{#[[1]], #[[2]]}]& /@ Select[list,
                                                     (#[[1]] > f1 && #[[2]] > f2) &], 
                         Frame -> True, PlotRange -> {{0, 10}, {0, 10}}]], 
              {{list1, list2}}]], 
{f1, 0, 10}, {f2, 0, 10}]

Now, I would like to display each fixation (point) one at a time, cumulatively.

That is :

Given

list1 = {{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, 
         {2, 5}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 1}, {4, 2}, {4, 3}, 
         {4, 4}, {4, 5}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}}

Use a slider to display the 1 to 25 Points here. But after filter the 1 to Length@Filtered Data

The Slider that control the Fixation number has yet a fixed boundary (25) , whereas it should have one equal to the Length of the filtered list.

But there is 2 due to Mapthread.

And I cannot extend the Mapthread to the Manipulate Control, could I ?

Manipulate[Row[MapThread[Function[{list},
                         Graphics[
                         Point[{#[[1]], #[[2]]}]& /@ Select[list,
                                                     (#[[1]] > f1 && #[[2]] > f2) &]
                                                     [[1 ;; dd, All]], 
                         Frame -> True, PlotRange -> {{0, 10}, {0, 10}}]], 
              {{list1, list2}}]], 
{f1, 0, 10}, {f2, 0, 10},{dd,0,25}]


Perhaps something like:

(Beware of code efficiency)

list1 = Tuples[Range[1, 5], 2];
list2 = Tuples[Range[3, 7], 2];
f = (Select[#, (#[[1]] > f1 && #[[2]] > f2) &] &);
Manipulate[
 Row@Graphics[Point@#, Frame -> True, PlotRange -> {{0, 10}, {0, 10}}] & /@ 
  Map[Map[f, {#}][[All, 1 ;; Min[dd, Length @@ Map[f, {#}]], All]] &,
  {list1, list2}], 
  {f1, 0, 10}, {f2, 0, 10}, {dd, 0, 25, 1}]

MapThread, Manipulate, Filter in Mathematica


Try it with {dd, 0, 25, 1}. This both allows it to parse correctly (closing brace) and keeps it real, so to speak, by preventing dd from being real valued.

0

精彩评论

暂无评论...
验证码 换一张
取 消