Re: Sum question and general comment
- To: mathgroup at smc.vnet.net
- Subject: [mg50809] Re: Sum question and general comment
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 22 Sep 2004 00:11:15 -0400 (EDT)
- Organization: The University of Western Australia
- References: <ci8m99$bpg$1@smc.vnet.net> <ci9b6c$i4n$1@smc.vnet.net> <cild69$r36$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cild69$r36$1 at smc.vnet.net>, Janusz Kawczak <jkawczak at math.uncc.edu> wrote: > this is neat, but I cannot reproduce your results. For the first sum > I am getting 5/(i-2) and other will not evaluate at all. What am I > missing? I've checked the Notebook and it runs fine for me I suspect that you might have TraditionalForm as your Default Output FormatType? Try setting the menu entries "Cell"->"Default Input FormatType" and "Cell"->"Default Output FormatType" to StandardForm, quit the kernel, and then re-execute the Notebook. Ordinarily, unlike most Mathematica users, I use TraditionalForm for both input and output. However, because most people use StandardForm, I generated this example using StandardForm input and output. The Notation package uses the FormatType to determine which form to create the notation in. It is possible to override this by adding the option WorkingForm->TraditionalForm when defining a notation. At http://physics.uwa.edu.au/pub/Mathematica/MathGroup/ you will find a second version of the original Notebook called TestSumIteratorTraditional.nb that expects TraditionalForm as the Default Input and Output FormatType. Cheers, Paul > Paul Abbott wrote: > > > In article <ci8m99$bpg$1 at smc.vnet.net>, > > Steve Gray <stevebg at adelphia.net> wrote: > > > > > I don't want to overload the group with my questions, so I only post > > > after > > > not being able to find the answer in the Help or at the site. Part of the > > > problem of course is that it isn't clear how to state the question so > > > that > > > I can look it up*. Anyway, the current question has to do with Sum and > > > similar "indexed" operations: > > > > > > I find no way to do, for example, > > > "Sum over i=1 to 100 except i!= 23 and 36", etc., > > > > There is a way to do this (posted to MathGroup in February this year): > > 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 > > > > > or Sum over values belonging to a list, such as > > > "Sum over i (belonging to) {1,2,3,5,7,8,21}", etc., > > > > In this case, the most natural operation is to use Map. It is not too > > hard to implement your own notation for this using Element. > > > > > "Sum ( i=1 to 10) Sum (0ver j=1 to 10 but j !=i)", etc. (this can be > > > awkwardly done with j=1 to i-1 and j=i+1 to 10) > > > In some cases there can be workarounds using things like > > > (1- KroneckerDelta[i,j]), etc., but these can get complicated and > > > obscure. > > > > No matter what notation you define, internally the computation will > > likely have to use constructs such as this. The point is that you would > > like Mathematica to form these constructs automatically and, most > > likely, hide them from view. > > > > > * Someone who makes major progress on the problem of letting users > > > communicate with a computer in ordinary, appropriate technical "people" > > > language will have big success. > > > > Personally, I think the Notation package is a tremendous step in this > > direction. > > > > > Part of the answer would be a greatly expanded index, compiled knowing > > > what > > > terms people are likely to use for their questions. > > > > Uniform notation (or notation conversion is required) also. > > > > 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 > -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 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