MathGroup Archive 2003

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

Search the Archive

Re: Evaluating a polynomial on a matrix; matrix computations over a finite field

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43150] Re: Evaluating a polynomial on a matrix; matrix computations over a finite field
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 14 Aug 2003 07:06:35 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <bhd9c5$roj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <bhd9c5$roj$1 at smc.vnet.net>, Lot-o-fun <lotofun at hotmail.com> 
wrote:

> How do I compute p(A), where p is a polynomial and A is a matrix?
> 
> For example, if
> 
> p[x_] := x^2 - 3x + 2
> 
> and
> 
> A = {{1,2},{3,4}}, then I want to compute
> 
> p(A) = A^2 - 3A + 2I = {{6,4},{6,12}}
> 
> Is there some way of doing this?

Here is one way. For your polynomial,

  p[x_] := x^2 - 3x + 2

extend it to handle matrices by replacing powers of the variable by 
MatrixPower:

  p[x_?MatrixQ] := Module[{t}, Expand[t p[t]]/.t^n_.:>MatrixPower[x,n-1]]

Try it out

  A = {{1,2},{3,4}}

  p[A]

  {{6, 4}, {6, 12}}

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


  • Prev by Date: Re: TeXForm Qns.
  • Next by Date: Re: Nonlinear fit for a non-differentiable function
  • Previous by thread: Re: Evaluating a polynomial on a matrix; matrix computations over a finite field
  • Next by thread: Don't want similar symbols to match pattern