cf2num
- :
y =cf2num(a)¶ - :
[n, d] =cf2num(a)¶ Evaluate a simple continued fraction, or return its convergents.
a is a nonempty real vector of partial quotients
[a0; a1, a2, …]. With one output,cf2numreturns the numeric value of the finite continued fraction. With two outputs it returns the numerator and denominator vectors of every convergent (Wallis recurrence), each the same size as a, son(k) ./ d(k)is the k-th convergent.Output class is
singlewhen a is single, otherwisedouble.Behaviour note (MATLAB R2026a): MathWorks does not ship
cf2numin R2026a. Nexus provides this name for next-wave math-012 (nexus#1861). Fora = num2cf (pi, 4)the convergents are 3/1, 22/7, 333/106, 355/113.