MathGroup Archive 2004

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

Search the Archive

Simplify doesn't simplify SparseArrays


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


  • Prev by Date: Re: Diophantic Equations with Constraints
  • Next by Date: Re: Diophantic Equations with Constraints
  • Previous by thread: RE: Applying my function to elements of a vector
  • Next by thread: Admin - Posts getting filtered