plotperm.mws

>    with(plots);

>    plotperm := proc(w::list,i::integer)

>      local c, n, g_1, g_2;

>      c := nops(w);

>      if i-1 <> c then

>         g_1 := pointplot({seq([n,w[n]],n=1..i-1)},symbolsize=30,color=green):

                   g_2 := pointplot({seq([n,w[n]],n=i..c)},symbolsize=30,color=red):

>         display([g_1,g_2],axes=boxed,symbol=circle);

>      else

>         g_1 := pointplot({seq([n,w[n]],n=1..c)},symbolsize=30,color=green):

       display([g_1],symbolsize=30,color=green,axes=boxed,symbol=circle);

>      fi;

>    end:

>   

>   

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...

>    plotperm([6,3,2,9,1,2,9,11,12,7,8,5,6,1,1,3,2,1,2,6,4,5],2);

[Maple Plot]

>    with(combinat,randperm);

[randperm]

>    plotperm(randperm(12),3);

[Maple Plot]

>    inserc := proc(w::list)

>      local c,v,i,j,m;

>      i := 2;

>      v := w;

>      c := nops(w);

>      plotperm(v,i);

>      while i <= c do

>        j := i-1;

>               m := v[i];

>        while (j > 0 and v[j] > m) do

>          v[j+1] := v[j];

>          j := j-1;

>       end do;

>       v[j+1] := m;

>       print(plotperm(v,i));

>       print(v);

>       i := i+1;   

>      end do;

>     plotperm(v,c+1);

>     end:

>    inserc(randperm(10));

[Maple Plot]

[8, 10, 5, 4, 3, 7, 2, 6, 9, 1]

[Maple Plot]

[5, 8, 10, 4, 3, 7, 2, 6, 9, 1]

[Maple Plot]

[4, 5, 8, 10, 3, 7, 2, 6, 9, 1]

[Maple Plot]

[3, 4, 5, 8, 10, 7, 2, 6, 9, 1]

[Maple Plot]

[3, 4, 5, 7, 8, 10, 2, 6, 9, 1]

[Maple Plot]

[2, 3, 4, 5, 7, 8, 10, 6, 9, 1]

[Maple Plot]

[2, 3, 4, 5, 6, 7, 8, 10, 9, 1]

[Maple Plot]

[2, 3, 4, 5, 6, 7, 8, 9, 10, 1]

[Maple Plot]

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

[Maple Plot]

>    inserc([9, 1, 5, 4, 7, 10, 8, 12, 2, 6, 11, 3]);

[Maple Plot]

[1, 9, 5, 4, 7, 10, 8, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 5, 9, 4, 7, 10, 8, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 4, 5, 9, 7, 10, 8, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 4, 5, 7, 9, 10, 8, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 4, 5, 7, 9, 10, 8, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 4, 5, 7, 8, 9, 10, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 4, 5, 7, 8, 9, 10, 12, 2, 6, 11, 3]

[Maple Plot]

[1, 2, 4, 5, 7, 8, 9, 10, 12, 6, 11, 3]

[Maple Plot]

[1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 11, 3]

[Maple Plot]

[1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3]

[Maple Plot]

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

[Maple Plot]

>