MathGroup Archive 2001

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

Search the Archive

Re: Pattern matching "on the fly"

  • To: mathgroup at
  • Subject: [mg30122] Re: [mg30100] Pattern matching "on the fly"
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Sun, 29 Jul 2001 21:26:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Note,  however, that myexpand method gives a "general" answer to Tony 
MacKenzie's problem, which the series method does not. For example, 
suppose we wish to work in a in a quotient of the polynomial ring on x 
and y, where the following condition holds:




Suppose we now want to compute (x+y)^1000000. The series method is not 
applicable (I think) but:

myexpand[f_, n_] :=
   Fold[Expand[#1^2*If[#2 == 1, f, 1]] &, f, Rest[IntegerDigits[n, 2]]]


999999                      999999  1000000
{0.02 Second, x        + 1000000 x       y + 1000000 x y       + 
y       }

In principle one could do this with PolynomialReduce but I think  it 
would  take quite a while...

Andrzej Kozlowski
Toyama International University

On Sunday, July 29, 2001, at 03:07  PM, Allan Hayes wrote:

> From the results below it looks as if for getting the first three tems 
> of
> (1+x)^(10^6)  (the original example). Andrzej's method is quicker as a
> one-off calcuation. But the Series method that Bob and I suggested does 
> some
> cacheing and is quicker for repeats.

  • Prev by Date: Re: A Penny for Thought
  • Next by Date: Re: Pattern matching "on the fly" + Developer`ClearCache[]
  • Previous by thread: Re: Pattern matching "on the fly"
  • Next by thread: Re: Pattern matching "on the fly"