       Manipulate variables not getting evaluated

• To: mathgroup at smc.vnet.net
• Subject: [mg122824] Manipulate variables not getting evaluated
• From: Ken Levasseur <klevasseur at mac.com>
• Date: Fri, 11 Nov 2011 04:57:03 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Hello

I'm trying to control, using Manipulate, which rows of a matrix are
displayed.  But have run into a problem.   The code I annotate here is
copied without comments below.   For this example, I'll use this 2 by 3
matrix

A = {{1, 2, 3}, {4, 5, 6}};

The following works pretty much as I intend, although there is fixable
problem if all boxes are unchecked.

Manipulate[
Transpose[Transpose[A][[Select[Range, {a, b, c}[[#1]] & ]]]],
Evaluate[Sequence @@ {{a, {True, False}}, {b, {True,
False}}, {c, {True, False}}}]]

Now I want to do the same for larger matrices with various numbers of
columns so I've tried generalizing as follows:

Number of columns:

M = 3;

This generates a list of M symbols:   col1, col2,=85

switchlist = (ToExpression[StringJoin["col", ToString[#1]]] & ) /@
Range[M];

This generates a list of controllers for each symbol=85

switches = ({ToExpression[StringJoin["col", ToString[#1]]], {True,
False}} & ) /@ Range[M];

Now I expected this to work, but it fails:

Manipulate[
Transpose[Transpose[A][[Select[Range[M], switchlist[[#1]] & ]]]],
Evaluate[Sequence @@ switches]]

The problem is that the symbols in switchlist don't get evaluated.

Manipulate[switchlist, Evaluate[Sequence @@ switches]]

I've tried using controllers like {{col1,True},{True,False}} and that doesn't make a difference.    Any idea why this fails?

Ken Levasseur
UMass Lowell

******************
Code only:

A = {{1, 2, 3}, {4, 5, 6}};

Manipulate[
Transpose[Transpose[A][[Select[Range, {a, b, c}[[#1]] & ]]]],
Evaluate[Sequence @@ {{a, {True, False}}, {b, {True,
False}}, {c, {True, False}}}]]

M = 3;

switchlist = (ToExpression[StringJoin["col", ToString[#1]]] & ) /@
Range[M];

switches = ({ToExpression[StringJoin["col", ToString[#1]]], {True,
False}} & ) /@ Range[M];

Manipulate[
Transpose[Transpose[A][[Select[Range[M], switchlist[[#1]] & ]]]],
Evaluate[Sequence @@ switches]]

Manipulate[switchlist, Evaluate[Sequence @@ switches]]

```

• Prev by Date: Problem:a texture on only one face of a Polyhedron
• Next by Date: Re: CUDA XCompiler
• Previous by thread: Re: Problem:a texture on only one face of a Polyhedron
• Next by thread: Re: Manipulate variables not getting evaluated