MathGroup Archive 2005

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

Search the Archive

Re: Generate polynomial of specified degree


Clear[f]
Module[{C},f[x_,0]=C[0];
  f[x_,degree_Integer/;degree>0]:=C[degree] x^degree+f[x,degree-1]]

f[junk,10]

seems to work

On 9/22/05, Renan <renan.birck at gmail.com> wrote:
> Hello,
>
> Sorry if this may seem a silly question, but I readed the Mathematica
> help and found no references.
>
> Is there any function that can generate a polynomial of a given degree?
>
> e.g.
>
> For degree 1, f[x] would return a x + b
> For degree 2, f[x] would return a x^2 + b x + c (quadratic equation)
> For degree 3, f[x] would return a x^3 + b x^2 + c x + d (quadratic equation)
>
> Thanks,
> Renan - Canoas, RS, Brazil
>
>


--
Chris Chiasson
http://chrischiasson.com/contact/chris_chiasson


  • Prev by Date: Re: Generate polynomial of specified degree
  • Next by Date: Re: Beginner: Importing files, maintaining file format.
  • Previous by thread: Generate polynomial of specified degree
  • Next by thread: Re: Generate polynomial of specified degree