MathGroup Archive 2003

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

Search the Archive

Re: Series

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42679] Re: [mg42663] Series
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sun, 20 Jul 2003 06:20:57 -0400 (EDT)
  • References: <200307190719.DAA17009@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Konstantin L Kouptsov wrote:
> 
> When expanding a function of several arguments in series,
> I want to retain only terms having the total power not more than some
> number. For example:
> 
> Series[Sin[x - y^2], {x, 0, 3}, {y, 0, 3}]// Normal// Expand
> 
> gives
> 
> x - x^3/6 - y^2 + x^2 y^2/2
> 
> with the unwanted last term of power 4. How to do this in
> elegant/efficient way?
> 
> One way is to do
> 
> Series[Sin[a x - (a y)^2], {a, 0, 3}] /.{a->1}
> 
> but as the function gets more complicated, this way becomes ugly.
> 
> --
> Konstantin L Kouptsov
> Department of Physics, Washington State University

This is something of an OAQ ("occasionally asked question"). Your
approach is almost the recommended one, except it should be automated so
that you need not insert the new variable by hand. Code to do that was
first posted in MathGroup several years ago; one version is as follows.

series[f_, v_List, order_] := 
  Module[{e}, Expand[Normal[Series[f /. 
    Thread[v -> e*v], {e, 0, order}]] /. e -> 1]]

In[18]:= InputForm[series[Sin[x - y^2], {x,y}, 3]]
Out[18]//InputForm= x - x^3/6 - y^2

The URL's below may illuminate the history of this code.

http://forums.wolfram.com/mathgroup/archive/1997/Aug/msg00356.html
http://forums.wolfram.com/mathgroup/archive/1997/Aug/msg00388.html


Daniel Lichtblau
Wolfram Research


  • References:
    • Series
      • From: Konstantin L Kouptsov <kouptsov@wsu.edu>
  • Prev by Date: Re: Eulerian angles
  • Next by Date: Re: Simple recursion problem: there must be a simple answer!
  • Previous by thread: Series
  • Next by thread: Re: Series