Not quite there with operator function for matrix

• To: mathgroup at smc.vnet.net
• Subject: [mg123169] Not quite there with operator function for matrix
• From: Chris Young <cy56 at comcast.net>
• Date: Fri, 25 Nov 2011 04:55:46 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```I need to test to exclude numbers from getting applied to the parameter theta.

There's a picture at http://home.comcast.net/~cy56/Unflatten.png and a
notebook at http://home.comcast.net/~cy56/Unflatten.nb .

unflatten[
list_,
{dims__?((IntegerQ[#] && Positive[#]) &)}] \
:=
Fold[
Partition, list, Take[{dims}, {-1, 2, -1}]
]  \
/;
(Length[list] === Times[dims])

This will apply matrix mat as an operator to the parameter Î¸ :

op[mat_, Î¸_] :=
unflatten[
Through[Flatten[mat][Î¸]], Dimensions[mat]
]

In[536]:= op[( {
{Cos, -Sin},
{Sin, Cos}
} ), Î¸]

Out[536]= {{Cos[Î¸], (-Sin)[Î¸]}, {Sin[Î¸], Cos[Î¸]}}

In[537]:= op[( {
{Cos, -Sin, 0},
{Sin, Cos, 0},
{0, 0, 1}
} ), Î¸]

Out[537]= {{Cos[Î¸], (-Sin)[Î¸], 0[Î¸]}, {Sin[Î¸], Cos[Î¸], 0[Î¸]}, {0[Î¸],
0[Î¸], 1[Î¸]}}

In[539]:= %537 // MatrixForm

Out[539]//MatrixForm= â??â?¢Ë?
TagBox[
RowBox[{"(", "", GridBox[{
{
RowBox[{"Cos", "[", "Î¸", "]"}],
RowBox[{
RowBox[{"(",
RowBox[{"-", "Sin"}], ")"}], "[", "Î¸", "]"}],
RowBox[{"0", "[", "Î¸", "]"}]},
{
RowBox[{"Sin", "[", "Î¸", "]"}],
RowBox[{"Cos", "[", "Î¸", "]"}],
RowBox[{"0", "[", "Î¸", "]"}]},
{
RowBox[{"0", "[", "Î¸", "]"}],
RowBox[{"0", "[", "Î¸", "]"}],
RowBox[{"1", "[", "Î¸", "]"}]}
},

GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}], "", ")"}],
Function[BoxForm`e\$,
MatrixForm[BoxForm`e\$]]]

```

• Prev by Date: Re: Root finding needs higher accuracy
• Next by Date: Memory low for PDE
• Previous by thread: Re: CDF examples
• Next by thread: Memory low for PDE