MathGroup Archive 1999

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

Search the Archive

Re: Horner's method on subexpressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17403] Re: Horner's method on subexpressions
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Thu, 6 May 1999 02:44:17 -0400
  • References: <7gjeaa$cmh@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ben Raphael <braphael at ucsd.edu> wrote in message
news:7gjeaa$cmh at smc.vnet.net...
> I have a sequence of expressions that contain polynomials and other
> terms.  An example is an expression of the form:
>
> 1/2 Re[-2/x^28 + 2(1+x)^56 / x^28] + Re[(1 / (-1 + 2x)^29) (high degree
> polynomial in x)]/483298748
>
> The polynomials that appear have integer coefficients.  What I would
> like to do is rewrite this expression by applying the Horner[] function
> to the polynomial, in order to speed up evaluation.  However, the Horner
> function only takes polynomial arguments, so one way to proceed is to
> extract the polynomial term, apply Horner and then reconstruct the
> expression.  Does anyone know an efficient way to do this, or have
> method to suggest?
>
> Thanks,
>
> Ben Raphael
> braphael at ucsd.edu
>

Ben

<<NumericalMath`Horner`

1/2 Re[-2/x^28 + 2(1+x)^56 / x^28] +
    Re[(1 / (-1 + 2x)^29) ]/483298748/.(p_?(PolynomialQ[#,x]&)):>
Horner[p,x]

You might want to do some preliminary manipulation of the subparts.

Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565




  • Prev by Date: Re: How to: PlotRange->{0, All} ?
  • Next by Date: Re: Animations
  • Previous by thread: Horner's method on subexpressions
  • Next by thread: Re: Horner's method on subexpressions