Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Product command with matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87864] Re: [mg87834] Product command with matrices
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Sat, 19 Apr 2008 03:31:57 -0400 (EDT)
  • References: <200804180640.CAA12618@smc.vnet.net>

On Apr 18, 2008, at 2:40 AM, 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

You are confusing Dot and Product, do you want to multiply matrix  
elements together eg:

{{a,b},{c,d}} {{e,f},{g,h}} = {{a e,b f},{c g,d h}}

or do a regular matrix multiply?  If the latter then

Phi[n_]:=Fold[(Id+#2 A).#1&,Id+f[0] A,Table[f[i],{i,1,n-1}]]

should work.

Regards,

Ssezi



  • Prev by Date: Re: Quantile and InverseCDF
  • Next by Date: FrontEnd and JLink
  • Previous by thread: Product command with matrices
  • Next by thread: Re: Product command with matrices