Simplify doesn't simplify SparseArrays
- To: mathgroup at smc.vnet.net
- Subject: [mg49479] Simplify doesn't simplify SparseArrays
- From: semorrison_ at hotmail.com (Scott Morrison)
- Date: Wed, 21 Jul 2004 06:40:29 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
For example, I was expecting
Normal[Simplify[SparseArray[{{1,1}->1/q^2+q(1/q+q)},{1,1}]]]
to return the same as
Simplify[Normal[SparseArray[{{1,1}->1/q^2+q(1/q+q)},{1,1}]]]
but it doesn't. Any suggestions for a modification? I was thinking of
unprotecting SparseArray, and defining
SparseArray /: Simplify[sa_SparseArray] :=
SparseArray[Simplify[ArrayRules[sa]],Dimensions[sa]]
Should this work? Would it be better for this definition to go with
Simplify rather than SparseArray?
Thanks, Scott Morrison