Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: Alternative to defining 'operator' function?

  • To: mathgroup at
  • Subject: [mg47559] RE: [mg47505] Alternative to defining 'operator' function?
  • From: "David Park" <djmp at>
  • Date: Fri, 16 Apr 2004 05:20:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


What about...

Rest@FoldList[Dot[#2, #1] &, v, {R1, R2, R3, R4}]
{R1.v, R2.R1.v, R3.R2.R1.v, R4.R3.R2.R1.v}

David Park
djmp at 

From: Owen, HL (Hywel) [mailto:H.L.Owen at]
To: mathgroup at

Hi folks,

I often have programming problem where I'd like to calculate a set of dot
products, e.g. applying a list of square matrices {R1,R2,R3...} to a vector
v to obtain:


or other functions like that.

The method I've been using is to define an 'operator' function, e.g.

DotOperator[M_] := Dot[M, #] &

Then we have:

In: DotOperator[R][v]
Out: R.v

as wanted, so that we can define a ComposeList as

In: Rest[ComposeList[DotOperator[#] & /@ {R1, R2, R3}, v]]
Out: {R1.v, R2.R1.v, R3.R2.R1.v}

to obtain the result we want.

Is there a simpler way than this that doesn't involve defining functions
like DotOperator?



  • Prev by Date: Re: How to check if a file exists?
  • Next by Date: Re: What does +- mean?
  • Previous by thread: Re: Alternative to defining 'operator' function?
  • Next by thread: RE: Alternative to defining 'operator' function?