## Name:

guessdegree returns the minimal degree needed for a polynomial to approximate a function with a certain error on an interval.

## Usage:

guessdegree(f,I,eps,w) : (function, range, constant, function) -> range

## Parameters:

• f is the function to be approximated.
• I is the interval where the function must be approximated.
• eps is the maximal acceptable error.
• w (optional) is a weight function. Default is 1.

## Description:

• guessdegree tries to find the minimal degree needed to approximate f on I by a polynomial with an error err=p*w-f whose infinity norm not greater than eps. More precisely, it finds n minimal such that there exists a polynomial p of degree n such that ||p*w-f|| < eps.
• guessdegree returns an interval: for common cases, this interval is reduced to a single number (e.g. the minimal degree). But in certain cases, guessdegree does not succeed in finding the minimal degree. In such cases the returned interval is of the form [n,p] such that:
• no polynomial of degree n-1 gives an error less than eps.
• there exists a polynomial of degree p giving an error less than eps.

## Example 1:

> guessdegree(exp(x),[-1;1],1e-10);
[10;10]

## Example 2:

> guessdegree(1, [-1;1], 1e-8, 1/exp(x));
[8;9]