Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6719
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Not quite there with operator function for matrix |
| Date | 2011-11-25 10:00 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <janovj$b22$1@smc.vnet.net> (permalink) |
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$]]]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Not quite there with operator function for matrix Chris Young <cy56@comcast.net> - 2011-11-25 10:00 +0000
csiph-web