Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6631 > unrolled thread

Re: Matrices as operators

Started byOliver Ruebenkoenig <ruebenko@wolfram.com>
First post2011-11-22 12:24 +0000
Last post2011-11-22 12:24 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Matrices as operators Oliver Ruebenkoenig <ruebenko@wolfram.com> - 2011-11-22 12:24 +0000

#6631 — Re: Matrices as operators

FromOliver Ruebenkoenig <ruebenko@wolfram.com>
Date2011-11-22 12:24 +0000
SubjectRe: Matrices as operators
Message-ID<jag49b$6b$1@smc.vnet.net>

On Tue, 22 Nov 2011, Ray Koopman wrote:

> On Nov 20, 2:34 am, Chris Young <c...@comcast.net> wrote:
>> I'd like to be able to abbreviate matrices such as rotation matrices
>> so that I don't have to repeat the argument. This way I can pass in
>> more complicated arguments and it also shows the structure of the
>> transformation more clearly.
>>
>> Through[( {
>>     {Cos, -Sin},
>>     {Sin, Cos}
>>    } )[=CE=B8]]
>>
>> will get me partway there:
>>
>> Out: {{Cos, -Sin}[=CE=B8], {Sin, Cos}[=CE=B8]}
>>
>> I have to apply Thread and Through again to finally get what I want:
>>
>> In: Thread[Through[{{Cos, -Sin}[=CE=B8], {Sin, Cos}[=CE=B8]}]]
>>
>> Out: {{Cos[=CE=B8], (-Sin)[=CE=B8]}, {Sin[=CE=B8], Cos[=CE=B8]}}
>>
>> Is there a shortcut way to do this all in one step?
>>
>> Thanks very much for any help.
>>
>> Chris Young
>> c...@comcast.net
>
> If you're worried about redundant calculations when the matrices
> are bigger than 2 x 2 and the functions are more complicated than
> Sin and Cos, try something like
>
> R[t_] := {{#1,-#2},{#2,#1}}&[Cos@t,Sin@t]
>
>

You could have the expression optimizer even further optimize that

Experimental`OptimizeExpression[{{#1, -#2}, {#2, #1}} &[Cos@t, Sin@t]]

(That is what happens in Compile)

Oliver

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web