# Compose two special power series expansions

I have two functions $A(x), B(x)$, given in a special power series form:

$A(x)=1-x^{2}\left(\frac{a}{10}-\sum_{k=1}^{9}b_{k}\left(\frac{(x^{2}-1)}{r}\right)^{k}\right)$

$B(x)=1-x^{2}\left(\frac{c}{10}-\sum_{k=1}^{9}d_{k}\left(\frac{(x^{2}-1)}{r}\right)^{k}\right)$

where $a,b_{k},c,d_{k}$ are real numbers, and $r\in\mathbb{R}^{+}$.

What I want to do, is to find the composition of these series $A(B(x))$ in a similar form, i.e. find such $u=u(a,b_{k},c,d_{k},r)$ and $v_{k}=v_{k}(a,b_{k},c,d_{k},r)$ so that

$A(B(x))=1-x^{2}\left(\frac{u}{10}-\sum_{k}v_{k}\left(\frac{(x^{2}-1)}{r}\right)^{k}\right)$

I tried defining these series by brute force:

A[x_] := 1 - x^2*((a/10) + Sum[b[k]*((x^2 - 1)/r)^k, {k, 1, 9}]);

B[x_] := 1 - x^2*((c/10) + Sum[d[k]*((x^2 - 1)/r)^k, {k, 1, 9}]);


And then calling A[B[x]]//Expand but it took forever long to run. Is there an efficient way to get an explicit power series expansion for A[B[x]]?

Then I can just get the desired form by simple equating coefficients, but what my question is: how to get an output for A[B[x]] in the standard power series form?

Thanks! (this is not homework)

Your problem can be simplified a bit before you put it into Mathematica. For starters, because of the shared external form, you need only worry about the 'core' of the $A$ function, $$\tilde A(x)=\sum_{k=1}^{9}b_{k}\left(\frac{(x^{2}-1)}{r}\right)^{k},$$ and you will always have $u=a$. Further, because the expansion parameter $y=(x^2-1)/r\geq-1/r$ is the same in $B$ and in your expected expansion for $A\circ B$, you can simply use that: $$B(y)=1-(r\,y+1)\left(\frac{c}{10}-\sum_{k=1}^{9}d_{k}\,y^{k}\right).$$ With both these objects, your problem reduces to finding the $v_k$ such that $$\tilde A(B(y))=\sum_{k}v_{k}\,y^{k}.$$ To implement this, use

a[x_] := Sum[b[k] ((x^2 - 1)/r)^k, {k, 1, 9}];
B[y_] := 1 - (r y + 1) ((c/10) + Sum[d[k]*y^k, {k, 1, 9}]);


and you can simply find the kth coefficient $v_k$ by running

SeriesCoefficient[a[B[y]], {y, 0, k}]


This will return an explicit, exact expression whenever k is a nonnegative integer. Low numbers are reasonably fast, though as you go up into the twenties and thirties it starts to show some sluggishness. The highest coefficient is $k=180=2\times9\times10$, and takes about 11 minutes on my machine. Asking for $k=181$ returns zero as expected, also after about 11 minutes. I would therefore expect the whole series to take about $\tfrac12 180\times 11\,\text{min}=16.5\,\text{h}$ to calculate. This is not an amazingly exciting prospect but from the coefficients onwards it depends on exactly what you want to do with all of this.

• Thank you very much! I wouldn't have thought it would take 16.5h to calculate though… In fact, in my answer I will be using $A(B(x))$ up to the power 20. Is there a way to put this cutoff in the code so that I don't have to wait 16+ h for the unnecessary output. (or does simply putting $k=20$ in the last line work?) Thanks again! May 13, 2014 at 16:14
• Just tried putting it in, for $k=20$, but can't make sense of the output: it says "a very large output was generated". A piece looks smith like "...+(((-1 + <<1>>^2)^3 <<1>> (-(<<1>>/( 25 <<1>>)) + <<27>> + <<1>>/<<1>>))/r^3)+". May 13, 2014 at 16:19
• Going up to $k=20$ should be pretty fast - a few minutes at most. For all except the first few outputs, you will see an output like this one; clicking "Show Full output" will display it in full. As you can see, it's displayed in a summarized form because it is very long. However, you can still use it without problems, unless you need manual access to it (in which case: what made you expect simple expressions in the first place?). It's hard to go beyond this without knowing what you want out of this. May 13, 2014 at 16:55
• I see, thanks. Well, ultimately what I want is to bring the composition in the "$u,v_{k}$" form, like I wrote in the question. In fact, I only need an estimate for the norm $||A(B(x))||$, however, my norm is only defined for the expression brought to that "special" power series form. For example, given that $A(x)$ is given as in the question, then $||A||=|a|+\sum_{k}|b_{k}|$ May 13, 2014 at 17:00
• The reason I asked for the coefficients of the usual power series, is that I thought if I have a standard power series expression, then I can find the $u$ and $v_{k}$ by equating coefficients for powers of $x$, by putting two arrays equal. Or is there a better/more efficient way of doing it? May 13, 2014 at 17:02