0
|
2464 Views
|
6 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

# How can I expand a power series with power series coefficients?

Posted 10 years ago
 If I type in a power series in which one of the coefficients is itself a power series, the appropriate simplifications happen automatically.  For example, typing 1 + (3 + 5 x + O[x]^3) x + O[x]^7gives1 + 3 x + 5 x^2 + O[x]^4But if I instead substitute in the coefficient series after the fact, as in(1 + a x + O[x]^7) /. a -> 3 + 5 x + O[x]^3I end up with a SeriesData object whose coefficients are themselves SeriesData objects:1 + (3 + 5 x + O[x]^3) x + O[x]^7Given this structure, how can I now cause the appropriate simplifications to happen?  ExpandAll doesn't do it, and I don't know what else to try.The attached notebook gives the same example,Lyle Ramshaw Attachments:
6 Replies
Sort By:
Posted 10 years ago
 This does seem like less than desirable behavior. Will look into it.
Posted 10 years ago
 You can define a function:In:= Clear[lyle]lyle[a_] := 1 + a x + O[x]^7In:= lyle[3 + 5 x + O[x]^9]Out= SeriesData[x, 0, {1, 3, 5}, 0, 7, 1]In:= lyle[3 + 5 x + O[x]^3]Out= SeriesData[x, 0, {1, 3, 5}, 0, 4, 1]lyle[] does the right thing without rule-driven programming exercises.SincerelyUdo.
Posted 10 years ago
 Udo's clever idea of using a function application, rather than a transformation rule, in order to substitute one series in as a coefficient of another series has solved my immediate problem very neatly -- thank you!  But it might be nice if using a transformation rule also worked in this context,Lyle
Posted 10 years ago
 Sure:      (i)                seemingly one has to use Normal[]      (ii)               but in order to keep the error term one has to do the Normal[] on the non-dominant error termIn:= 1+a x+O[x]^7/. a-> Normal[3+5 x+O[x]^9]Out= 1+3 x+5 x^2+O[x]^7In:= Normal[1+a x+O[x]^7]/. a-> 3+5 x+O[x]^3Out= 1+3 x+5 x^2+O[x]^4it would be quite an exercise to apply Normal[] automatically to the  non-dominant error term - the goal is to avoid nested SeriesData[] expressions for the time being.
Posted 10 years ago
 One has to use Normal[]  In:= (1 + a x + O[x]^7) /. a -> 3 + 5 x + O[x]^3 // Normal  Out= 1 + 3 x + 5 x^2  In:= Normal[(1 + a x + O[x]^7)] /. a -> 3 + 5 x + O[x]^3 Out= SeriesData[x, 0, {1, 3, 5}, 0, 4, 1]  In:= FullForm[(1 + a x + O[x]^7) /. a -> 3 + 5 x + O[x]^3] Out//FullForm= SeriesData[x,0,List[1,SeriesData[x,0,List[3,5],0,3,1]],0,7,1]nested SeriesData[] seem not to Expand[], %292 does what you possibly  expect.
Posted 10 years ago
 Udo, thanks for the tip; but Normal does not do what I want, since it truncates the series to which it is applied.  Truncating the outer series in the particular example that I gave happens to produce the correct answer, since the error term of O^7 in the outer series ends up being ignored.  But, in other examples, truncating would give the wrong answer.  I want to combine the inner and outer power series with the proper semantics, as happens correctly if both series are part of the initial typein.  For example, typing in1 + (3 + 5 x + O[x]^9) x + O[x]^7gives1+ 3 x + 5 x^2 + O[x]^7while typing in1 + (3 + 5 x + O[x]^3) x + O[x]^7gives1+ 3 x + 5 x^2 + O[x]^4Note that, in the first example, it is the error term of the outer series that dominates, while, in the second example, it is the error term of the inner series that dominates.  If I just apply Normal to either of the two series, I will lose this correct behavior.Lyle