MathGroup Archive 2009

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

Search the Archive

Can't apply Differences[] to a SparseArray[]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99312] Can't apply Differences[] to a SparseArray[]?
  • From: jmay <jason.may at gmail.com>
  • Date: Sat, 2 May 2009 06:01:10 -0400 (EDT)

Mathematica newbie here.

I'd like to apply the Differences[] function to a sparse array.  Other
list operations appear to work, but I'm seeing this:

    s = SparseArray[{5, 6, 7} -> {10, 11, 12}]

    Differences[s]

        Differences::list: List expected at position 1 in Differences
[SparseArray[Automatic,{7},0,{1,{{0,3},{{5},{6},{7}}},{10,11,12}}]].

What is special about Differences?  I don't want to convert the sparse
array to a regular list; my data set could have thousands or millions
of missing elements.

Thanks,
-Jason


  • Prev by Date: Re: Re: New Wolfram Tutorial Collection documentation is
  • Next by Date: Re: How to select several cells
  • Previous by thread: Re: Inverse function
  • Next by thread: Re: Can't apply Differences[] to a SparseArray[]?