Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Multiplying large polynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14712] Re: Multiplying large polynomials
  • From: Rolf Mertig <rolf at mertig.com>
  • Date: Tue, 10 Nov 1998 01:21:04 -0500
  • Organization: Mertig Research & Consulting
  • References: <7257a7$88m@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thomas Bell wrote:
> 
> I'm trying to multiply two huge polynomials, and memory is a major
> concern.  I want to truncate the resulting polynomial to a specified
> power (N) in one of the variables (h), and I was wondering if it was
> possible to tell Mathematica to not bother multiplying two terms if the
> resulting power of h was greater than N.  This is, of course, in the
> hope that this "automatic truncation" would save time and memory.  For
> example, if
> 
> poly1 = a h^2 + b;
> poly2 = d h + e;
> N = 2;
> 
> then I would like to result to be
> 
> result = a e h^2 + b d h + b e
> 
> Instead, I have to write
> 
> result = Expand[poly1 poly2]/.h^3 -> 0;
> 
> which forces Mathematica to create the enormous product before
> truncating.  Please cc to tombell at stanford.edu, and thanks in advance
> for any suggestions.

-- 

In[1]:=  poly1=a h^2+b + O[h]^3;

In[2]:= poly2 = d h+e + O[h]^3;

In[3]:=  poly1 poly2 // Normal //InputForm

Out[3]//InputForm= b*e + b*d*h + a*e*h^2


Rolf Mertig

Mertig Research & Consulting  
Mathematica training and programming Development and distribution of
FeynCalc  Amsterdam, The Netherlands
http://www.mertig.com


  • Prev by Date: Re: How to transpose vector?
  • Next by Date: Re: Abs and derivative problems
  • Previous by thread: Re: Multiplying large polynomials
  • Next by thread: Re: Multiplying large polynomials