# LogicalExpand to find coefficients in power series

I am attempting to use the LogicalExpand command to find an equation for each coefficient in a power series. The documentation gives the following example of this usage:

In[1]:= LogicalExpand[Series[g[x]^2,{x,0,2}]==2+x]

Out[1]= -2+g[0]^2==0&&-1+2 g[0] g'[0]==0&&g'[0]^2+g[0] g''[0]==0


The goal is to get a system of equations like the one above corresponding to the coefficients of each power of $$x$$ in the power series.

My series is more complicated than the one in the documentation, and it should be identically equal to $$0$$, so that each coefficient should be identically zero. When I apply the LogicalExpand function, however, Mathematica simply returns the original input rather than a system of equations. The expression to which I am trying to apply logical expand is: $$\frac{1}{6} x \left(f'(0) h''(0)+h'(0) \left(f'(0) \left(2 h'(0)+3\right)+3\right)+h''(0)+6\right)+\frac{1}{12} x^2 \left(f''(0) \left(h''(0)+h'(0) \left(2 h'(0)+3\right)\right)-2 f'(0)^2 \left(h''(0)+h'(0) \left(4 h'(0)+3\right)\right)-4 f'(0) \left(h''(0)+h'(0) \left(h'(0)+3\right)+3\right)\right)=0$$

In Mathematica:

In[2]:=LogicalExpand[
1/6 x (6 + h'[0] (3 + f'[0] (3 + 2 h'[0])) + h''[0] + f'[0] h''[0]) +
1/12 x^2 (-4 f'[0] (3 + h'[0] (3 + h'[0]) + h''[0]) + f''[0] (h'[0] (3 + 2 h'[0]) + h''[0]) -
2 f'[0]^2 (h'[0] (3 + 4 h'[0]) + h''[0])) == 0]

Out[2]:=
1/6 x (6 + h'[0] (3 + f'[0] (3 + 2 h'[0])) + h''[0] + f'[0] h''[0]) +
1/12 x^2 (-4 f'[0] (3 + h'[0] (3 + h'[0]) + h''[0]) + f''[0] (h'[0] (3 + 2 h'[0]) + h''[0]) -
2 f'[0]^2 (h'[0] (3 + 4 h'[0]) + h''[0])) == 0


I would appreciate any thoughts on why this is failing. Thank you!

Try with ordersymbol O[x] :

LogicalExpand[1/6 x (6 + h'[0] (3 + f'[0] (3 + 2 h'[0])) + h''[0] +f'[0] h''[0]) +1/12 x^2 (-4 f'[0] (3 + h'[0] (3 + h'[0]) + h''[0]) +f''[0] (h'[0] (3 + 2 h'[0]) + h''[0]) -2 f'[0]^2 (h'[0] (3 + 4 h'[0]) + h''[0])) == O[x]^3]

(*1/6 (6 + Derivative[1][h][0] (3 + Derivative[1][f][0] (3 + 2 Derivative[1][h][0]))
+ (h^\[Prime]\[Prime])[0] + Derivative[1][f][0] (h^\[Prime]\[Prime])[0]) == 0
&&
1/12 (-4 Derivative[1][f][0] (3 + Derivative[1][h][0] (3 + Derivative[1][h][0])+ (h^\[Prime]\[Prime])[0]) + (f^\[Prime]\[Prime])[0] (Derivative[1][h][0] (3 + 2 Derivative[1][h][0])
+ (h^\[Prime]\[Prime])[0]) -2 Derivative[1][f][0]^2 (Derivative[1][h][0] (3 + 4 Derivative[1][h][0])
+ (h^\[Prime]\[Prime])[0])) == 0*)

• Brilliant! That exactly solves it, thank you. Mar 11, 2021 at 17:36