MathGroup Archive 2005

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

Search the Archive

Re: Skipping Elements in Sum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61104] Re: Skipping Elements in Sum
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 10 Oct 2005 02:40:06 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 10/9/05 at 1:36 AM, qcadesigner at gmail.com wrote:

>Does anyone know how to skip elements using the mathematica sum?
>e.g. take the sum of all i, where i not equal to j.

Yes.

One way to do this with the Sum function would be to use the KroneckerDelta function as follows:

Sum[Subscript[a, n](1 - KroneckerDelta[n, 3]), {n, 5}]

Another way to create the same sum would be

Total[Table[Subscript[a, n], {n, 5}][[Complement[
    Range[5], {3}]]]]

and there are many other ways to achieve the same result. Which is best depends on exactly what you are trying to accomplish.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: show only very second or third tick
  • Next by Date: Re: Dashing shown in legend?
  • Previous by thread: Re: Skipping Elements in Sum
  • Next by thread: Re: Skipping Elements in Sum