[Date Index]
[Thread Index]
[Author Index]
Goldberg Variationen
*To*: mathgroup at smc.vnet.net
*Subject*: [mg4015] Goldberg Variationen
*From*: Vandemoortele CC Group R&D Center <wouter.meeussen.vdmcc at vandemoortele.be>
*Date*: Mon, 20 May 1996 02:12:34 -0400
*Sender*: owner-wri-mathgroup at wolfram.com
>In article <4menll$jva at dragonfly.wolfram.com>,
>Jack Goldberg <jackgold at admin.lsa.umich.edu> wrote:
>Hello Mma users,
>
>... I need to write the trinomial expansion
>out in terms of Sum. Something like this:
>
>tri[a_,b_,c_,n_] := Sum[Multinomial[i,j,k]*a^i*b^j*c*k, ???]
>where i+j+k = n. (Multinomial is a built-in function.)
>
>The problem is with the iterator(s). The condition i+j+k = n
>is causing me great difficulty. What would be nice is a solution
>that works in the general multinomial case, but perhaps that is asking
>too much - I would be happy for the trinomial expansion.
>
>The more general issue here is this: Many sums in mathematics (most
>more important than the above trivial problem) are indexed over more
>complicated sets than allowed by the syntax of Sum. For example,
>open any book on number theory - I opened my copy of An Introduction
>To The Theory of Numbers, I. Niven et. al. - and found the Mobius
>inversion formula, pg 194, part
>of which reads (subject to the limitation of my keyboard)
>
>The sum over all divisors d of n of the product of
>mu(d)*F(n/d) ...
>
>Instead of having to recast this remarkable formula into terms
>understandable by Sum, wouldn't it be nice to have the set over
>which the sum is taken be given as the iterator. Then my trinomial
>problem would be solved like this:
>
>tri[a_,b_,c_,n_] := Sum["as above", {i+j+k=n}]
>
>Your thoughts are more than welcome!
and Dave Wagner answered:
>The most general solution to the problem is to write a function that
>generates a list of all of the indices, map the summand over the list
>(the summand has to be converted to a pure function first), and
>then apply Plus to the result. The generator function would be different
>for every special sum, but the rest could be automated. For example,
>you could make a new definition for Sum[summand_Function, generator_],
>in which the first argument is the summand and the second argument
>is the index-set generator function. The definition would be
>*something* like this (untested!):
>
> Sum[summand_Function, generator_] :=
> Plus @@ summand /@ generator[]
>
>For the multinomial problem, you might use:
>
> Sum[ Times @@ {a,b,c}^# &, f]
>
>where f is a suitable function from DiscreteMath`Combinatorics` that
>generates a list of the indices. The result should be a list of
>triples {i, j, k}.
>
>I don't have time to work out the details, but you asked for my
>thoughts, and those are them.
>
Elementary, my dear Watson...
so I took a look in 'The Book' pg 133 and found no
suitable function from DiscreteMath`Combinatorics` that generates a list of
the indices.
next I looked in 'The Guide to Standard Mma Packages' and again came up blank.
so, not being a mathematician but a chemist, I fiddled around with this
beautiful gem of a problem, and came up with a 'messy chemists' workaround :
the list of indices for a general case with r variables is:
n=3;
r=3;
indic=i/@Range[r];
DeleteCases[
Table[indic , Evaluate[Sequence@@Map[{#,0,n}& , indic]]]~Flatten~(r-1),
a_/;Plus@@a !=n]
this produces:
{{0, 0, 3}, {0, 1, 2}, {0, 2, 1}, {0, 3, 0}, {1, 0, 2}, {1, 1, 1}, {1, 2,
0}, {2, 0, 1}, {2, 1, 0}, {3, 0, 0}}
Of course, generaly, n and r need not be equal.
I dare (sorry, read: 'invite') you mathematicians out there,
to demonstrate us how it should be done properly...
If anyone out there could come up with a 'elegant' method, not by first
generating all combinations and then leaving out the bad ones, I would be
interested to know how (and how it was found).
The beauty of the problem (hence forward known as 'Goldberg Variations')
deserves it.
Wouter.
==== [MESSAGE SEPARATOR] ====
Prev by Date:
**3D Curve fitting**
Next by Date:
**Innacurate Solve results**
Previous by thread:
**Re: 3D Curve fitting**
Next by thread:
**Re: Goldberg Variationen**
| |