Ask Your Question
0

Change Valuation to do Series Reversion

asked 2021-06-23 08:10:02 +0200

dispo gravatar image

updated 2021-06-23 08:16:18 +0200

I've run into the problem of doing series reversion with symbolic power series a few times now, and while in the past I was able to hack together a solution (by using some inelegant combination of f.taylor(), f.series(), s.truncate(), s.power_series(QQbar), etc.), today I wasn't able to figure out how to get what I want done.

Concretely, let's say you want to compute a power series for those $x$ such that $x \sin(x) + \cos(x) = 0$ (as indeed I do). This can only happen when $\sin(x) \approx 0$, so we want to look near $n \pi$.

Here we can cheat a little bit and use the fact that $\sin$ and $\cos$ are periodic to get a good series expansion for this. If we write $q = n \pi$, we get

q = var('q')
eps = var('eps')
s = (q + eps) * sin(eps).series(eps) + cos(eps).series(eps)
s = s.series(eps) # expand and collect terms

# symbolic power series don't have a .reverse() method
# so let's just work over a field that has a variable called q
R.<q> = PolynomialRing(QQbar)
F = FractionField(R)
S = PowerSeriesRing(F,eps)

s = S(s)

Now we have

$$ s = 1 + q \epsilon + \frac{1}{2} \epsilon^{2} -\frac{1}{6} q \epsilon^{3} -\frac{1}{8} \epsilon^{4} + \frac{1}{120} q \epsilon^{5} + \ldots $$

Since we want to know that $x \sin(x) + \cos(x) = 0$, we should set $s = 0$ and solve for $\epsilon$ (which will depend on $n$). Then our roots will be exactly $q + \epsilon$, that is, $n \pi + \epsilon$. We can do this using lagrange inversion, where if $s^{-1}$ is the inverse of $s$ we'll have $\epsilon = s^{-1}(0)$ and our problem will be solved.

Unfortunately, there's no way (as far as I know) to do lagrange inversion on a symbolic series (and in my experience symbolic power series are probably best avoided anyways. It seems like other people share this belief too). I'm happy to do this trick of working over some other field, but I'm getting an error: s.reverse() is telling me series must have valuation one for reversion. I think this is happening since q.valuation() is returning $0$ for some reason. This is strange, since F(q).valuation() = 1, as expected, but then S(F(q)).valuation() = 0 again.

Is there a way I can force sage to see that q is invertible?

If not, is there another (better) way to handle series reversion with variable coefficients?

Thanks in advance! ^_^

edit retag flag offensive close merge delete

Comments

1

More direct way to get S

sage: q = polygen(QQ,'q')                                                         
sage: eps = QQ['q'][['ϵ']].0                                                    
sage: s = (q + eps)*sin(eps)+cos(eps)                                           
sage: s                                                                         
1 + q*ϵ + 1/2*ϵ^2 - 1/6*q*ϵ^3 - 1/8*ϵ^4 + 1/120*q*ϵ^5 + 1/144*ϵ^6 - 1/5040*q*ϵ^7 - 1/5760*ϵ^8 + 1/362880*q*ϵ^9 + 1/403200*ϵ^10 - 1/39916800*q*ϵ^11 - 1/43545600*ϵ^12 + 1/6227020800*q*ϵ^13 + 1/6706022400*ϵ^14 - 1/1307674368000*q*ϵ^15 - 1/1394852659200*ϵ^16 + 1/355687428096000*q*ϵ^17 + 1/376610217984000*ϵ^18 - 1/121645100408832000*q*ϵ^19 + O(ϵ^20)
FrédéricC gravatar imageFrédéricC ( 2021-06-23 14:58:42 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2021-08-19 03:08:16 +0200

Max Alekseyev gravatar image

updated 2021-08-19 04:39:13 +0200

It needs to be understood that solution $\epsilon$ to $(q+\epsilon)\sin(\epsilon) + \cos(\epsilon)=0$ represents a power series in $\frac{1}{q}$ and not $q$. It is therefore convenient to introduce $r:=\frac{1}{q}$ and solve the equation: $$(\frac{1}{r} + \epsilon)\sin(\epsilon) + \cos(\epsilon) = 0.$$ To do so, we rewrite the equation as $$r = - \frac{\sin(\epsilon)}{ \epsilon\sin(\epsilon) + \cos(\epsilon)}$$ and perform series reversion of the right hand side.

Running the following code

eps = QQ[['ϵ']].0
r = QQ[['r']].0
a = - sin(eps) / (cos(eps) + eps*sin(eps))
b = a.reverse()(r)
print(b)

gives power series -r - 2/3*r^3 - 13/15*r^5 - 146/105*r^7 - ..., that is the solution is $$\epsilon = -r - \frac23 r^3 - \frac{13}{15} r^5 - \frac{146}{105} r^7 - \dots$$

To verify it, we can run

print( (1/r + b)*sin(b) + cos(b) )

which gives O(r^19) as expected.

P.S. The coefficients' numerators and denominators are given by sequences A079330 and A088989 in the OEIS.

edit flag offensive delete link more

Comments

Thank you! I don't know how the idea of solving for a series in one variable, then reversing that and substituting the other variable never came to mind. As a quick mathematical aside, how can you tell in advance that we'll get a power series in $\frac{1}{q}$? Is it because $q \to \infty$, but $\epsilon \to 0$?

dispo gravatar imagedispo ( 2021-09-01 02:57:55 +0200 )edit
1

Yes, the series argument must be small, and so $q$ cannot be it, but $\frac1q$ can. However, series in $\frac1q$ would not be understood by Sage. Hence, we need to switch to another variable in order to apply the series machinery.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-09-01 03:06:41 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-06-23 08:10:02 +0200

Seen: 140 times

Last updated: Aug 19 '21