This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Numerical Computation / Number Representation /

Further Examples: ContinuedFraction

The result of ContinuedFraction is given as a list.

In[1]:=

Out[1]=

The continued fraction simplifies to the original fraction.

In[2]:=

Out[2]=

This gives the continued fraction representation of a quadratic number. The sublist represents the repeated part.

In[3]:=

Out[3]=

You can go back to the number with FromContinuedFraction.

In[4]:=

Out[4]=

This gives the first few terms of the continued fraction representation of a transcendental number.

In[5]:=

Out[5]=

Here is a special case of Pell's equation. In a Diophantine equation like this the parameter m and the variables x and y are assumed to be integers.

In[6]:=

PellSolve gives the least positive solution for x and y when m is not a perfect square.

In[7]:=

Here is the solution when m is .

In[8]:=

Out[8]=

In[9]:=

Out[9]=

In[10]:=

See also FromContinuedFraction.