MathGroup Archive 2011

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

Search the Archive

Function for complex polynomial with variable number of arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123543] Function for complex polynomial with variable number of arguments
  • From: Christopher Young <cy56 at comcast.net>
  • Date: Sat, 10 Dec 2011 07:31:38 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <6B531F58-6996-48AB-B533-D623A83444F2@gmail.com>

From: Heike Gramberg <heike.gramberg at gmail.com>
Subject: [mg123543] Re: Function for complex polynomial with variable number of arguments
Date: December 8, 2011 5:38:34 AM EST
To: Chris Young <cy56 at comcast.net>
Cc: mathgroup at smc.vnet.net

> You could do something like this
>
> poly[z_, p___] := Fold[(z - #2) #1 &, 1, {p}]
>
> This works for p=={} as well, i.e.
>
> poly[x+I y]
>
> returns 1.

I'm not sure what's going on with the Fold here. Would the #2 slot refer to the entry from the list, and the #1 slot to the "1"? At any rate, very interesting.




  • Prev by Date: C/Fortran-like #include functionality for large expressions?
  • Next by Date: While Loop
  • Previous by thread: Re: Function for complex polynomial with variable number of arguments
  • Next by thread: Re: Function for complex polynomial with variable number of arguments