# How to calculate this function

Please, I would like to calculate this function which contains an infinite continued fraction

f[y_]=1/(1 + ContinuedFractionK[-(((n + 1) (n + 3))/((2 n + 3) (2 n + 5))) y^2 A, 1, {n, 0, Infinity}])


Please, Is there a method to construct this infinite fraction and evaluate f[y]?

Many thanks.

This is correct, but because you have undefined A in the formula, it results in the expression. And, most likely, Mathematica can't find any simpler form for this expression either.

Compare this:

f[y_] :=
1/(1 + ContinuedFractionK[-(((n + 1) (n + 3))/((2 n + 3) (2 n +
5))) y^2 A, 1, {n, 0, Infinity}])

f[1]
(* ...formula view... *)

f[1] /. A -> 1
(* 3/2 *)

(* with A = 1 *)
g[y_] :=
1/(1 + ContinuedFractionK[-(((n + 1) (n + 3))/((2 n + 3) (2 n +
5))) y^2, 1, {n, 0, Infinity}])

g[1]
(* 3/2 *)


Or just define as a function of two variables:

h[y_, A_] :=
1/(1 + ContinuedFractionK[-(((n + 1) (n + 3))/((2 n + 3) (2 n +
5))) y^2 A, 1, {n, 0, Infinity}])

h[1, 1]
(* 3/2 *)


Letting $$t=A y^2$$, we can simplify our considerations to the following function of one variable:

maj[t] == 1/(1 + ContinuedFractionK[-(((n + 1) (n + 3))/((2 n + 3) (2 n + 5))) t, 1,
{n, 0, Infinity}])


Once again, the Lentz-Thompson-Barnett algorithm can be used for numerical evaluation:

maj[t_?InexactNumberQ] := Module[{a, c, d, e2, ee, f, h, k},
ee = 10^(-Precision[t]); e2 = ee^2;
f = c = 1; d = 0; k = 0;
While[k++;
a = -((k (k + 2))/((2 k + 1) (2 k + 3))) t;
d = 1 + a d; If[d == 0, d = e2]; d = 1/d;
c = 1 + a/c; If[c == 0, c = e2];
f *= (h = c d);
Abs[h - 1] > ee];
1/f]


which can be plotted:

Plot[maj[t], {t, -3, 1}]


Plot3D[maj[A y^2], {A, -2, 0}, {y, -1, 1}, Mesh -> None, PlotPoints -> 45]


• J. M., many thanks for your answer. Please can you explain me this algorithm? – Majorana Apr 18 at 16:00
• I linked to the two papers explaining the evaluation method for your CF; please refer to them if you want to know details. – J. M.'s discontentment Apr 18 at 16:03
• J. M., thank you so much. Please, can you apply the same algorithm to this fraction 1/(1 + x y + ContinuedFractionK[(n (n + 1) I (x/B)) - (n (n + 2))/(4 (n + 1)^2 - 1)x^2 A, 1, {n, 1, Infinity}])? – Majorana Apr 18 at 16:15
• That should prolly be a separate question. – J. M.'s discontentment Apr 18 at 16:17
• It's the same question but modified! – Majorana Apr 18 at 16:23