Matthew D Litwin wrote:
>
> Hi,
>
> I'm working with series with fractional exponents, and have a few
> questions on how to efficiently do certain operations.
>
> 1) Suppose you have a series like f=1 +x^(1/2) +x + x^(3/2) +O[x]^2 What
> is the most efficient way to apply a transformation like x -> x^(2/3)
> which would yield a series with order O[x]^(4/3). The best I've found
> is to operate on Normal[f] and add the O[x] term by hand, but this
> seems slower than it need be for long series.
>
> 2) Suppose you have two (or three) such series and are taking the
> product, call it P, and you know that the only non-zero terms in P are
> of the form A x^n, where n is an integer. Is there any way to avoid
> computing the fractional terms in P?
>
> Thank you for any suggestions,
>
> -Matt Litwin
> matt at math.ucsb.edu
Not certain, but the answer to 2) is probably "no."
For 1) you might do as follows.
interleave[ll_List, len_Integer] := With[{zeroes=Table[0,{len}]},
Flatten[Map[{#,zeroes}&, ll]]]
replaceWithPower[ser_SeriesData, (pow_Rational|pow_Integer)] := Module[
{g=ser, num=Numerator[pow]},
If [num!=1, g[[3]] = interleave[g[[3]], num-1]];
g[[4]] *= num;
g[[5]] *= num;
g[[6]] *= Denominator[pow];
g
]
For example:
In[34]:= InputForm[f = 1 + x^(1/2) + x + x^(3/2) + O[x]^2]
Out[34]//InputForm= SeriesData[x, 0, {1, 1, 1, 1}, 0, 4, 2]
In[35]:= g = replaceWithPower[f, 2/3]
1/3 2/3 4/3 Out[35]= 1 + x + x + x +
O[x]
(* Looks good, but let's check the InputForm to be certain *)
In[36]:= InputForm[g]
Out[36]//InputForm= SeriesData[x, 0, {1, 0, 1, 0, 1, 0, 1}, 0, 8, 6]
To see why this works:
In[37]:= ??SeriesData
SeriesData[x, x0, {a0, a1, ... }, nmin, nmax, den] represents a power
series
in the variable x about the point x0. The ai are the coefficients in
the
power series. The powers of (x-x0) that appear are nmin/den,
(nmin+1)/den,
... , nmax/den.
Attributes[SeriesData] = {Protected, ReadProtected}
Daniel Lichtblau
Wolfram Research