Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: matrices & polynomials in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27271] Re: matrices & polynomials in mathematica
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 17 Feb 2001 03:30:43 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <96iqj6$d90@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

two rules ???

f[x_?NumericQ] := 1 + x + x^2
f[x_?MatrixQ] /; Equal @@ Dimensions[x] := 
  Module[{n = First[Union[Dimensions[x]]]},
     IdentityMatrix[n] + x + Dot[x, x]
    ]

scan the coefficients of the polynomial for numbers and replace
the numbers by c_?NumericQ :> c*IndentityMatrix[c] and replacing times
by Dot[] may help. But essential the extension of of polynomial to
a matrix is very different from a scalar polynomial.

Regards
  Jens

"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.


  • Prev by Date: Re: numerics
  • Next by Date: Re: How can I find the closest distance between a specified point and an interpolation curve?
  • Previous by thread: Re: matrices & polynomials in mathematica
  • Next by thread: Re: matrices & polynomials in mathematica