Re: matrices & polynomials in mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg27275] Re: matrices & polynomials in mathematica
- From: Erich Mueller <emuelle1 at uiuc.edu>
- Date: Sat, 17 Feb 2001 03:30:47 -0500 (EST)
- Organization: University of Illinois at Urbana-Champaign
- References: <96iqj6$d90@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You could try replacing Power with MatrixPower. Here is an example: Poly = (1 + x)^3 + 2; clist = CoefficientList[Poly, x]; MatPoly = (MatrixPower[x, #] & /@ (Range[Length[clist]] -1)).clist Erich On 16 Feb 2001, news.tue.nl wrote: > Hi, > > I have the following problem. > I have written a mathematica-module that automatically produces a certain > polynomial as a result. But I want another module to use this first module > and fill in a matrix in this polynomial. > for example: f[x]=1+x+x^2 > But when I compute f[A] where A is a matrix, mathematica interprets 1 as a > matrix filled with ones in stead of the identity-matrix. And A^2 is > pointswise multiplication in stead of matrix-multiplication. > Is there an option to let Mathematica know that the polynomial works on > matrices? > > Chris > > PS. I am aware of the possibility to multiply matrices using . (dot) but the > problem is that the polynomial is the result of some computations and I need > to have mathematica interpret this polynomial on matrices automatically. > > > > >