MathGroup Archive 2007

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

Search the Archive

Re: Mathematica: Long divison for polynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83809] Re: Mathematica: Long divison for polynomials
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 1 Dec 2007 05:41:51 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fiopuv$ae7$1@smc.vnet.net>

Caren Balea wrote:

<snip>

> g(x)/h(x) can be also written as
> g(x)/h(x) = 1 - a1*x  + (a1^2 - a2)*x^2 + ...
> 
> How do I obtain the last expression?
> Which command do I need to use?

It looks like you are talking about power series expansion, am I right? 
In this case, just use the built-in function *Series* and possibly 
*Normal* if you want to manipulate k(x) as a polynomial. For instance,

In[1]:= g[x_] := 1
h[x_] := 1 + a1*x + a2*x^2 + a3*x^3 + a4*x^4

In[3]:= Series[g[x]/h[x], {x, 0, 2}]

Out[3]= (SeriesData[$CellContext`x, 0, {
  1, -$CellContext`a1, $CellContext`a1^2 - $CellContext`a2}, 0, 3, 1])

(* The above line looks better within the FrontEnd ! *)

In[4]:= k[x_] = Normal@Series[g[x]/h[x], {x, 0, 2}]

Out[4]= 1 - a1 x + (a1^2 - a2) x^2

In[5]:= k[2]

Out[5]= 1 - 2 a1 + 4 (a1^2 - a2)

Regards,
-- 
Jean-Marc


  • Prev by Date: Question about exponent shorthand
  • Next by Date: Re: how draw box with open front
  • Previous by thread: Re: Question about exponent shorthand
  • Next by thread: Re: Mathematica: Long divison for polynomials