7
$\begingroup$

To build basic continued fraction one can simply use:

Nest[1/(1 + #) &, x, 3]

enter image description here


However, it's unclear how using Nest function one can generate continued fraction of the following type:

enter image description here


I tried:

Nest[#/(1 + #) &, x, 3],

with the result:

enter image description here

Which is clearly not what I expected.

$\endgroup$
11
$\begingroup$

This is what you need:

Nest[x/(1 + #) &, x, 3]
$\endgroup$
3
$\begingroup$

Try the following.

f = Replace[#, 1/a_ -> x/a] &;

g[n_Integer] := Map[f, Nest[1/(1 + #) &, x, n], Infinity] // f;

Let us check

g[5]

enter image description here

g[10]

enter image description here

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.