RE: redefine Power[A_?MatrixQ,-1]
- To: mathgroup at smc.vnet.net
- Subject: [mg32640] RE: [mg32593] redefine Power[A_?MatrixQ,-1]
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 1 Feb 2002 02:02:53 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Cyril,
Why don't you use MatrixPower? It does what you want without redefinition.
The reason redefining Power didn't work is that Power has the attribute
listable. This chews right into your matrix. The following would work but it
is probably too much of an alteration of Power.
Unprotect[Power];
Power[mat_?MatrixQ, n_Integer] := MatrixPower[mat, n]
Attributes[Power] = {}
Protect[Power];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> -----Original Message-----
> From: Cyril Fischer [mailto:fischerc at itam.cas.cz]
To: mathgroup at smc.vnet.net
> Sent: Thursday, January 31, 2002 1:45 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg32640] [mg32593] redefine Power[A_?MatrixQ,-1]
>
>
> Hi,
> How can I redefine Power[A_?MatrixQ,-1] := Inverse[A] ?
>
> Issuing
> Unprotect[Power];
> Power[A_?MatrixQ,-1] := Inverse[A]
>
> does not work.
> Thanks, Cyril
>
>