MathGroup Archive 1998

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

Search the Archive

Re: "Help please: Summing a list"

  • To: mathgroup at
  • Subject: [mg13510] Re: "Help please: Summing a list"
  • From: erra at (ERRA Robert)
  • Date: Fri, 31 Jul 1998 04:33:25 -0400
  • Organization: The Math Forum
  • References: <6pebm8$>
  • Sender: owner-wri-mathgroup at

Hello Rob,

in place of

use the following definition:

PP[i_]:=Sum[P[[n]],{n,1,i}]; (*1*)

or, if you really want to use the function PP with only integer
arguments, you can use
PP[i_Integer]:=Sum[P[[n]],{n,1,i}]; (*2) but in your case this is not a
problem to use (*1*). Take a look about definition of a function to
understand the use of i_ in place of i in the definition.
A Mathematica list begins always with the indice 1, if you ask P[[0]]
you will have the Head of P, i.e.

Have a look at FullForm[P] to see why.

A bientôt,
Robert Erra.

  • Prev by Date: Overriding default rules
  • Next by Date: Mathematica and Win98?
  • Previous by thread: Overriding default rules
  • Next by thread: Mathematica and Win98?