# How can I calculate the root of any order of power series

How can I calculate the root of any order of power series with Mathematica.

Here I insert every quantity by hand. But I want to give a, b, n, L values and order of series and so automatically calculate all r and ECornell values.

n = 0; a = 1; L = 0; b = 0.01; m = 1/2 ; g = (2 m a r)/(n + L + 1);
f[r_] = AiryAi[(2 m b)^(1/3)  (r)];
NumberForm[FindMaximum[r^(L + 1) f[r], {r}], {13, 13}];
r0 = 4.103398736759;

Series[1/r, {r, r0, 4}]
r1inv = 0.24370042107821896 -0.05938989523370123 (r1 - 4.103398736759) +0.0144733424762443 (r1 - 4.103398736759)^2 - 0.0035271596558700082 (r1 - 4.103398736759)^3 + 0.0008595702933456269 (r1 - 4.103398736759)^4;
NumberForm[Solve[r1inv - 1/r == 0, r], {13, 13}];
NumberForm[FindRoot[r1inv - 1/r == 0, {r, 13}], {13, 13}];
NumberForm[r1 = 1/r1inv, {13, 13}];
NumberForm[ECornell = -((m a^2)/(2 (n + L + 1)^2)) + (a/(L + 1) - (L + 1)/(m r1)) f'[r1]/f[r1], {13, 13}];

• Do you mean, Solve[0 == Normal@Series[1/r, {r, r0, 4}], r]? – march Jan 31 '16 at 21:40
• no. I mean, 1/r=Series[1/r, {r, r0, 4}] – Yücel Cançelik Jan 31 '16 at 21:43
• So, adapt my code snippet to yours? Maybe I don't know what you mean by "root of any order of power series". Can you edit your post with more details? – march Jan 31 '16 at 21:44
• ok. I see :) thank you. I will try it – Yücel Cançelik Jan 31 '16 at 21:50
• in fact my problem is above. here I insert every quantity by hand. tried to your suggestion but not work – Yücel Cançelik Jan 31 '16 at 22:16

n = 0;
a = 1;
L = 0;
b = 1/100;
m = 1/2;
g = (2 m a r)/(n + L + 1);
f[r_] = AiryAi[(2 m b)^(1/3) r];

r0 = r /.
FindMaximum[r^(L + 1) f[r], r, WorkingPrecision -> 20][[2]] //
Rationalize[#, 0] &;

r0 // N // InputForm

(*  4.103398736759  *)

r1inv = Series[1/r, {r, r0, 4}] //
Normal // Simplify;

r0 == r /. Solve[r1inv - 1/r == 0, r, Reals][[1]]

(*  True  *)

r0 == r /. FindRoot[r1inv - 1/r == 0, {r, r0},
WorkingPrecision -> 16]

(*  True  *)

Clear[ECornell]

ECornell[r_] = -((m a^2)/(2 (n + L + 1)^2)) +
(a/(L + 1) - (L + 1)/(m r)) f'[r]/f[r] //
Simplify;

(ECornell[1/r1inv] /. r -> r0) == ECornell[r0]

(*  True  *)

Plot[{ECornell[r], ECornell[1/r1inv]},
{r, 0, 8},
WorkingPrecision -> 20,
PlotLegends -> "Expressions",
Epilog -> {
Tooltip[Text["r0", {r0, 0}, {0, -1.5}], r0 // N],
Red, Dashed,
Line[{{r0, 0}, {r0, ECornell[r0]}}]}]


• My aim is to fit the r0(rmax) to the r1. For b=0.01 ad L=0 r0(r_max)=4.103398736759 but I must fit the r1=1.7436481088. This is why? Because, if and only if I'm using this value(r1=1.7436481088) can go to the correct result for ECornell=-0.2210305634048. – Yücel Cançelik Feb 1 '16 at 6:31
• The match will be at the expansion point. You chose r0 as the expansion point so the match is there. – Bob Hanlon Feb 1 '16 at 6:45
• Can you give more details? I don't know what you mean – Yücel Cançelik Feb 1 '16 at 6:48
• Truncated series expansions are only good approximations near the expansion point. The fewer terms used the closer you need to be to the expansion point. Note that the curves diverge as you move away from the expansion point (r0). If you know that you want a close fit at some particular r value then use that r value as the expansion point. – Bob Hanlon Feb 1 '16 at 6:58
• you are right. thanks – Yücel Cançelik Feb 1 '16 at 7:03