MathGroup Archive 1996

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

Search the Archive

Re: multinomials: a programming question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4007] Re: [mg3923] multinomials: a programming question
  • From: Robert Pratt <rpratt at math.unc.edu>
  • Date: Tue, 14 May 1996 02:39:29 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I just met up with a similar problem using cyclotomic polynomials to 
factor x^n-1.  The dth cyclotomic polynomial has as its root the 
primitive dth roots of unity.  x^n-1 = product over divisors d of n of the 
dth cyclotomic polynomial.  I would like to iterate over the set 
Divisors[n], but this is too complicated for Mma to understand 
directly.  So instead, I iterate from 1 to Length[Divisors[n]] and then 
apply Divisors[n][[i]] before taking the cyclotomic polynomial.  This 
composition of functions works nicely when the domain is restrictive 
(MMA forces the iterating set to be arithmetic sequences, but 
Divisors[n] does not form an arithmetic sequence).

factorxnminus1[n_]:=
	Product[Cyclotomic[Divisors[n][[i]], x], {i, 1 Length[Divisors[n]]}]

The same approach should work for you.  Define the iterating set you 
want, and then use iteratingset[[i]] and {i, 1, Length[iteratingset]} in 
your Sum command.

Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill
CB# 3250, 331 Phillips Hall
Chapel Hill, NC  27599-3250

rpratt at math.unc.edu

On Fri, 10 May 1996, Jack Goldberg wrote:

> 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!
> 
> Jack Goldberg
> University of Michigan
> 
> 
> 


==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Julian Day Calculation - Plea for Help
  • Next by Date: Re: AxesLabels question
  • Previous by thread: Re: multinomials: a programming question
  • Next by thread: Inverse of IntegerDigits? and "Index" function?