Name:

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

Library names:

sollya_obj_t sollya_lib_guessdegree(sollya_obj_t, sollya_obj_t,                                     sollya_obj_t, ...) sollya_obj_t sollya_lib_v_guessdegree(sollya_obj_t, sollya_obj_t,                                       sollya_obj_t, va_list)

Usage:

guessdegree(f,I,eps,w,bound) : (function, range, constant, function, constant) -> 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.
• bound (optional) is a bound on the degree. Default is currently 128.

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 (i.e. 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.
• The fifth optional argument bound is used to prevent guessdegree from trying to find too large degrees. If guessdegree does not manage to find a degree n satisfying the error and such that n<=bound, an interval of the form [*, +Inf] is returned. Note that bound must be a positive integer.

Example 1:

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

Example 2:

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

Example 3:

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