MathGroup Archive 2008

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

Search the Archive

Re: Product command with matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87889] Re: Product command with matrices
  • From: J Davis <texasAUtiger at gmail.com>
  • Date: Sat, 19 Apr 2008 03:36:30 -0400 (EDT)
  • References: <fu9ft7$ce2$1@smc.vnet.net> <fu9vr5$iim$1@smc.vnet.net>

On Apr 18, 6:14 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
wrote:
> Hi,
>
> Times[] is not Dot[] and Product[] and no equivalent to use
> Dot[] instedad of Times[] and there is no (easy) way to
> tell Mathematica that f[1] is a matrix and what may be A
> a scalar ? a vector or a matrix too ? Even I can't find it out
> and Mathematica can't know it.
>
> You mean
>
> DotProduct[mtx_, {i_, i1_, in_}] := Dot @@ Table[mtx, {i, i1, in}]
>
> Phi[0] := Id;
> Phi[n_] := DotProduct[Id + f[i] ** A, {i, 0, n - 1}]
>
> and
>
> Phi[3] gives
>
> (Id + f[0] ** A).(Id + f[1] ** A).(Id + f[2] ** A)
>
> Regards
>    Jens
>
> J Davis wrote:
> > I want to define a matrix valued function such as the following (in
> > LaTeX lingo):
>
> > $$
> > X(0)=Id,
> > X(n)=\prod_{i=0}^{n-1} (Id + f[i] A)
> > $$
>
> > where A and f have already been defined and Id is the identity matrix
> > of appropriate size.
>
> > I tried the following:
>
> > Id=IdentityMatrix[2];
> > Phi[0]:=Id;
> > Phi[n_]:= Product[Id + f[i] A,{i,0,n-1}]
>
> > However, Phi[3] and (Id+f[2]A).(Id+f[1]A).(Id+f[0]A) do not agree.
>
> > Any help around this would be appreciated.

Thanks very much to W Craig Carter (and others) who replied to me via
email. I thought I would share the following very efficient solution:

Phi[n_]:=Apply[Dot,Table[Id + f[k]A,{k,0,n-1}]]


  • Prev by Date: Re: Re: EdgeRenderingFunction to produce edge
  • Next by Date: Re: SparseArray memory usage
  • Previous by thread: Re: Product command with matrices
  • Next by thread: Re: Product command with matrices