Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

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