converts the number x to one of the "simplest" algebraic numbers that approximates it well.


finds an algebraic number of degree at most n that approximates x.

Details and Options

  • For degrees above 2, RootApproximant generates Root objects.
  • RootApproximant[x] effectively tests the total number of bits in the description of x by successively higher-degree algebraic numbers, and returns the first case for which the number of bits is small.
  • Results from RootApproximant may not be unique.
  • MinimalPolynomial yields the minimal polynomial for the result of RootApproximant.
  • The option Method->{"DegreeCost"->p} specifies an additional cost p to be used for each successively higher power in determining the "simplest" approximation.


open allclose all

Basic Examples  (2)

Find a quadratic approximation to :

Find algebraic approximants of any order:

Scope  (4)

There is no simple quadratic approximation to N:

At degree 4, there is a simple answer, which turns out to be equal to :

Machine precision is not enough to recover the Root object equal to :

30 digits of precision suffice to recover the exact value here:

When given exact input, RootApproximant uses machine-precision approximations:

RootApproximant works with complex numbers:

Options  (1)

Method  (1)

Assigning additional cost to higher powers can be used to lower the degree of result:

Applications  (2)

Find successive algebraic approximations to :

A complicated radical expression:

Use FindRoot to find the real root near 2.5:

Use RootApproximant to find an algebraic number close to the root:

Check whether the result is a root of the original expression:

Properties & Relations  (3)

RootApproximant gives a Root object close to a given algebraic number:

The Root object found may not be exactly equal to the input:

Use RootReduce to find exact Root object representations of algebraic numbers:

Specifying a linear polynomial effectively finds a rational approximation to x:

Rationalize also gives a rational approximation, but it need not be the same:

Interestingly, the approximations can be found among continued fraction convergents:

Use LatticeReduce to recognize linear combinations of more general functions:

The final relationship :

Possible Issues  (1)

Recognizing an algebraic number may require using higher precision:

The result is not equal to a:

Providing the correct degree improves the chances of recognizing an algebraic number:

A penalty may be used to lower the degree; here it does not help in recognizing the number:

Using a higher-precision approximation allows the algebraic number to be recognized:

Introduced in 2007
Updated in 2008