Re: Summation limits
- To: mathgroup at smc.vnet.net
- Subject: [mg46664] Re: Summation limits
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 27 Feb 2004 02:57:58 -0500 (EST)
- Organization: The University of Western Australia
- References: <c1lu5g$nse$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <c1lu5g$nse$1 at smc.vnet.net>, tinkham at ucalgary.ca (tinkham)
wrote:
> I want to do a summation, using the symbol form from clicking on the
> palette button, but want to put a test on the index of the iterator.
> for example, I will have global variables, k=5 and p = 2, and want to
> do a summation from i=1 to k, where i != p. How do I enter the lower
> limit i=1;i!=p ?
You cannot put a test on the index of the iterator because iterators do
not permit this, independent of the form of input. For example,
With[{k=5,p=2},Sum[i,{i,1,k}]]
is, of course, ok. And, if you convert this input to StandardForm (or
TraditionalForm) you get the same 2D form as you would get from a
palette.
However, there is AFAIK, no way to modify the _iterator_ of
Sum[i,{i,1,k}] to include a test.
> I realize that I can just wrap the expression being summed in an
> If[i!=p, ...], but it would be nice if I could just put this test in
> the lower limit.
There is a way to do this: use the Notation package to define your own
input notation that accepts a lower limit of the form, say i != 1 = p.
See
http://physics.uwa.edu.au/pub/Mathematica/MathGroup/TestSumIterator.nb
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul