MathGroup Archive 2006

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

Search the Archive

Re: Lists and polynomials

  • To: mathgroup at
  • Subject: [mg71048] Re: [mg71023] Lists and polynomials
  • From: Carl Woll <carlw at>
  • Date: Mon, 6 Nov 2006 02:53:00 -0500 (EST)
  • References: <>

aland wrote:

>Hi All,
>Another beginner here!
>I am trying to create a list based around a polynomial.
>In particular, I want to work with a large-ish number based on a power
>of 2
>629 x^2  + 863 x + 271
>where x = 2^10
>What I want to do is take a number y such as y=6718213 and derive a
>list where the list values are the coefficients of the polynomial.
>So that if my number y=1027 (2^10 +3)
>the polynomial would be
>and the list would be { 1,3 }
>I have tried NestWhileList[] and PolynomialRemainder[]  but I'm really
>struggling to get them to do what I want.  I have a procedural
>programming background; functional programming looks excellent, I just
>can't get it to work!
>Any suggestions (like you're using the wrong functions, try these
>others....) would be gratefully received.
>I'm also looking to convert the list back into a number once I've
>finished working with the polynomial.
>Mathematica v4.2, although it probably doesn't make a lot of
>Thanks in advance,
If I understand your problem correctly, then the simplest solution is to 
use IntegerDigits and FromDigits:

IntegerDigits[1027, 2^10]
{1, 3}

gives the list you want, and:

FromDigits[{1, 3}, 2^10]

converts back into your original number. You could even use FromDigits 
to convert to the polynomial form:

FromDigits[{1, 3}, x]
x + 3

Carl Woll
Wolfram Research

  • Prev by Date: Re: Workbench: get nb's into a project & compare them
  • Next by Date: Re: Factor.....
  • Previous by thread: Lists and polynomials
  • Next by thread: Re: Lists and polynomials