Re: Alternative to defining 'operator' function?
- To: mathgroup at smc.vnet.net
- Subject: [mg47637] Re: Alternative to defining 'operator' function?
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Mon, 19 Apr 2004 04:33:07 -0400 (EDT)
- Organization: The University of Western Australia
- References: <c5o9o1$181$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <c5o9o1$181$1 at smc.vnet.net>,
"Owen, HL (Hywel)" <H.L.Owen at dl.ac.uk> wrote:
> Paul's idea is a good one if you need to generate a symbolic set of
> expressions (not right for my problem though):
>
> Subscript[R, n_][v_] := Subscript[R, n]
> Rest[ComposeList[Subscript[R,1], Subscript[R,2], Subscript[R,3]}, v]]
This code works fine in general. For example, suppose your set of
matrices is
Subscript[A, n_] := {{a[n],b[n]},{c[n],d[n]}}
and the vector is
v = {x,y}
If you modify the definition of Subscript[R, n_][v_] to
Subscript[R, n_][v_] := Subscript[A, n] . v
then
Rest[ComposeList[{Subscript[R,1], Subscript[R,2], Subscript[R,3]}, v]]
does what you want.
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul